english/libraries/joomla/form/form.php
/**
	 * Method to get a form field group represented as an XML element object.
	 *
	 * @param   string   $group  The dot-separated form group path on which to find the group.
	 *
	 * @return  mixed  An array of XML element objects for the group or boolean false on error.
	 *
	 * @since   11.1
	 */
Method to get a form field group represented as an XML element object.
@param   string   $group  The dot-separated form group path on which to find the group.

@return  mixed  An array of XML element objects for the group or boolean false on error.


Method to get a form field group represented as an XML element object . @param string $group The dot - separated form group path on which to find the group . @return mixed An array of XML element objects for the group or boolean false on error .
protected function &findGroup($group)
	{
		$false = false;
		$groups = array();
		$tmp = array();
		if (!($this->xml instanceof JXMLElement)) {
			return $false;
		}
		$group = explode('.', $group);
		if (!empty($group)) {
			$elements = $this->xml->xpath('//fields[@name="'.(string) $group[0].'"]');
			foreach ($elements as $element)
			{
				if (!$element->xpath('ancestor::fields[@name]')) {
					$tmp[] = $element;
				}
			}
			for ($i = 1, $n = count($group); $i < $n; $i++)
			{
				$validNames = array_slice($group, 0, $i+1);
				$current = $tmp;
				$tmp = array();
				foreach ($current as $element)
				{
					$children = $element->xpath('descendant::fields[@name="'.(string) $group[$i].'"]');
					foreach ($children as $fields)
					{
						$attrs = $fields->xpath('ancestor-or-self::fields[@name]/@name');
						$names = array_map('strval', $attrs ? $attrs : array());
						if ($validNames == $names) {
							$tmp[] = $fields;
						}
					}
				}
			}
			foreach ($tmp as $element)
			{
				if ($element instanceof JXMLElement) {
					$groups[] = $element;
				}
			}
		}
		return $groups;
	}
protected function & findGroup ( $ group ) { $ false = false ; $ groups = array ( ) ; $ tmp = array ( ) ; if ( ! ( $ this -> xml instanceof JXMLElement ) ) { return $ false ; } $ group = explode ( '.' , $ group ) ; if ( ! empty ( $ group ) ) { $ elements = $ this -> xml -> xpath ( '//fields[@name="' . ( string ) $ group [ 0 ] . '"]' ) ; foreach ( $ elements as $ element ) { if ( ! $ element -> xpath ( 'ancestor::fields[@name]' ) ) { $ tmp [ ] = $ element ; } } for ( $ i = 1 , $ n = count ( $ group ) ; $ i < $ n ; $ i ++ ) { $ validNames = array_slice ( $ group , 0 , $ i + 1 ) ; $ current = $ tmp ; $ tmp = array ( ) ; foreach ( $ current as $ element ) { $ children = $ element -> xpath ( 'descendant::fields[@name="' . ( string ) $ group [ $ i ] . '"]' ) ; foreach ( $ children as $ fields ) { $ attrs = $ fields -> xpath ( 'ancestor-or-self::fields[@name]/@name' ) ; $ names = array_map ( 'strval' , $ attrs ? $ attrs : array ( ) ) ; if ( $ validNames == $ names ) { $ tmp [ ] = $ fields ; } } } } foreach ( $ tmp as $ element ) { if ( $ element instanceof JXMLElement ) { $ groups [ ] = $ element ; } } } return $ groups ; }
Method to get a form field group represented as an XML element object.
Method to get a form field group represented as an XML element object .
// Initialise variables. // Make sure there is a valid JForm XML document. // Make sure there is actually a group to find. // Get any fields elements with the correct group name. // Check to make sure that there are no parent groups for each element. // Iterate through the nested groups to find any matching form field groups. // Initialise some loop variables. // Check to make sure that there are no parent groups for each element. // Get any fields elements with the correct group name. // For the found fields elements validate that they are in the correct groups. // Get the group names as strings for ancestor fields elements. // If the group names for the fields element match the valid names at this // level add the fields element. // Only include valid XML objects.