english/libraries/joomla/form/form.php
/**
	 * Method to get an array of <field /> elements from the form XML document which are
	 * in a control group by name.
	 *
	 * @param   mixed    $group   The optional dot-separated form group path on which to find the fields.
	 *                            Null will return all fields. False will return fields not in a group.
	 * @param   boolean  $nested  True to also include fields in nested groups that are inside of the
	 *                            group for which to find fields.
	 *
	 * @return  mixed  Boolean false on error or array of JXMLElement objects.
	 *
	 * @since   11.1
	 */
Method to get an array of  elements from the form XML document which are
in a control group by name.

@param   mixed    $group   The optional dot-separated form group path on which to find the fields.
Null will return all fields. False will return fields not in a group.
@param   boolean  $nested  True to also include fields in nested groups that are inside of the
group for which to find fields.

@return  mixed  Boolean false on error or array of JXMLElement objects.


Method to get an array of elements from the form XML document which are in a control group by name . @param mixed $group The optional dot - separated form group path on which to find the fields . Null will return all fields . False will return fields not in a group . @param boolean $nested True to also include fields in nested groups that are inside of the group for which to find fields . @return mixed Boolean false on error or array of JXMLElement objects .
protected function & findFieldsByGroup($group = null, $nested = false)
	{
		$false = false;
		$fields = array();
		if (!($this->xml instanceof JXMLElement)) {
			return $false;
		}
				if ($group) {
			$elements = & $this->findGroup($group);
			foreach ($elements as $element)
			{
				if ($tmp = $element->xpath('descendant::field')) {
					if ($nested) {
						$fields = array_merge($fields, $tmp);
					}
					else {
						$groupNames = explode('.', $group);
						foreach ($tmp as $field)
						{
							$attrs = $field->xpath('ancestor::fields[@name]/@name');
							$names = array_map('strval', $attrs ? $attrs : array());
							if ($names == (array) $groupNames) {
								$fields = array_merge($fields, array($field));
							}
						}
					}
				}
			}
		}
		else if ($group === false) {
			$fields = $this->xml->xpath('descendant::fields[not(@name)]/field | descendant::fields[not(@name)]/fieldset/field ');
		}
		else {
			$fields = $this->xml->xpath('//field');
		}
		return $fields;
	}
protected function & findFieldsByGroup ( $ group = null , $ nested = false ) { $ false = false ; $ fields = array ( ) ; if ( ! ( $ this -> xml instanceof JXMLElement ) ) { return $ false ; } if ( $ group ) { $ elements = & $ this -> findGroup ( $ group ) ; foreach ( $ elements as $ element ) { if ( $ tmp = $ element -> xpath ( 'descendant::field' ) ) { if ( $ nested ) { $ fields = array_merge ( $ fields , $ tmp ) ; } else { $ groupNames = explode ( '.' , $ group ) ; foreach ( $ tmp as $ field ) { $ attrs = $ field -> xpath ( 'ancestor::fields[@name]/@name' ) ; $ names = array_map ( 'strval' , $ attrs ? $ attrs : array ( ) ) ; if ( $ names == ( array ) $ groupNames ) { $ fields = array_merge ( $ fields , array ( $ field ) ) ; } } } } } } else if ( $ group === false ) { $ fields = $ this -> xml -> xpath ( 'descendant::fields[not(@name)]/field | descendant::fields[not(@name)]/fieldset/field ' ) ; } else { $ fields = $ this -> xml -> xpath ( '//field' ) ; } return $ fields ; }
Method to get an array of <field /> elements from the form XML document which are
 in a control group by name.
Method to get an array of <field / > elements from the form XML document which are in a control group by name .
// Initialise variables. // Make sure there is a valid JForm XML document. // Get only fields in a specific group?
 // Get the fields elements for a given group. // Get all of the field elements for the fields elements. // If there are field elements add them to the return result. // If we also want fields in nested groups then just merge the arrays. // If we want to exclude nested groups then we need to check each field. // Get the names of the groups that the field is in. // If the field is in the specific group then add it to the return list. // Get only field elements not in a group. // Get an array of all the <field /> elements.