public function getFieldsets($group = null)
	{
		$fieldsets = array();
		$sets = array();

		// Make sure there is a valid Form XML document.
		if (!($this->xml instanceof \SimpleXMLElement))
		{
			return $fieldsets;
		}

		if ($group)
		{
			// Get the fields elements for a given group.
			$elements = &$this->findGroup($group);

			foreach ($elements as &$element)
			{
				// Get an array of <fieldset /> elements and fieldset attributes within the fields element.
				if ($tmp = $element->xpath('descendant::fieldset[@name] | descendant::field[@fieldset]/@fieldset'))
				{
					$sets = array_merge($sets, (array) $tmp);
				}
			}
		}
		else
		{
			// Get an array of <fieldset /> elements and fieldset attributes.
			$sets = $this->xml->xpath('//fieldset[@name] | //field[@fieldset]/@fieldset');
		}

		// If no fieldsets are found return empty.
		if (empty($sets))
		{
			return $fieldsets;
		}

		// Process each found fieldset.
		foreach ($sets as $set)
		{
			// Are we dealing with a fieldset element?
			if ((string) $set['name'])
			{
				// Only create it if it doesn't already exist.
				if (empty($fieldsets[(string) $set['name']]))
				{
					// Build the fieldset object.
					$fieldset = (object) array('name' => '', 'label' => '', 'description' => '');

					foreach ($set->attributes() as $name => $value)
					{
						$fieldset->$name = (string) $value;
					}

					// Add the fieldset object to the list.
					$fieldsets[$fieldset->name] = $fieldset;
				}
			}
			else
			// Must be dealing with a fieldset attribute.
			{
				// Only create it if it doesn't already exist.
				if (empty($fieldsets[(string) $set]))
				{
					// Attempt to get the fieldset element for data (throughout the entire form document).
					$tmp = $this->xml->xpath('//fieldset[@name="' . (string) $set . '"]');

					// If no element was found, build a very simple fieldset object.
					if (empty($tmp))
					{
						$fieldset = (object) array('name' => (string) $set, 'label' => '', 'description' => '');
					}
					else
					// Build the fieldset object from the element.
					{
						$fieldset = (object) array('name' => '', 'label' => '', 'description' => '');

						foreach ($tmp[0]->attributes() as $name => $value)
						{
							$fieldset->$name = (string) $value;
						}
					}

					// Add the fieldset object to the list.
					$fieldsets[$fieldset->name] = $fieldset;
				}
			}
		}

		return $fieldsets;
	}
public function getFieldsets($group = null)
	{
		$fieldsets = array();
		$sets = array();

		// Make sure there is a valid Form XML document.
		if (!($this->xml instanceof \SimpleXMLElement))
		{
			return $fieldsets;
		}

		if ($group)
		{
			// Get the fields elements for a given group.
			$elements = &$this->findGroup($group);

			foreach ($elements as &$element)
			{
				// Get an array of <fieldset /> elements and fieldset attributes within the fields element.
				if ($tmp = $element->xpath('descendant::fieldset[@name] | descendant::field[@fieldset]/@fieldset'))
				{
					$sets = array_merge($sets, (array) $tmp);
				}
			}
		}
		else
		{
			// Get an array of <fieldset /> elements and fieldset attributes.
			$sets = $this->xml->xpath('//fieldset[@name] | //field[@fieldset]/@fieldset');
		}

		// If no fieldsets are found return empty.
		if (empty($sets))
		{
			return $fieldsets;
		}

		// Process each found fieldset.
		foreach ($sets as $set)
		{
			// Are we dealing with a fieldset element?
			if ((string) $set['name'])
			{
				// Only create it if it doesn't already exist.
				if (empty($fieldsets[(string) $set['name']]))
				{
					// Build the fieldset object.
					$fieldset = (object) array('name' => '', 'label' => '', 'description' => '');

					foreach ($set->attributes() as $name => $value)
					{
						$fieldset->$name = (string) $value;
					}

					// Add the fieldset object to the list.
					$fieldsets[$fieldset->name] = $fieldset;
				}
			}
			else
			// Must be dealing with a fieldset attribute.
			{
				// Only create it if it doesn't already exist.
				if (empty($fieldsets[(string) $set]))
				{
					// Attempt to get the fieldset element for data (throughout the entire form document).
					$tmp = $this->xml->xpath('//fieldset[@name="' . (string) $set . '"]');

					// If no element was found, build a very simple fieldset object.
					if (empty($tmp))
					{
						$fieldset = (object) array('name' => (string) $set, 'label' => '', 'description' => '');
					}
					else
					// Build the fieldset object from the element.
					{
						$fieldset = (object) array('name' => '', 'label' => '', 'description' => '');

						foreach ($tmp[0]->attributes() as $name => $value)
						{
							$fieldset->$name = (string) $value;
						}
					}

					// Add the fieldset object to the list.
					$fieldsets[$fieldset->name] = $fieldset;
				}
			}
		}

		return $fieldsets;
	}
public function getFieldsets ( $ group = null ) { $ fieldsets = array ( ) ; $ sets = array ( ) ; // Make sure there is a valid Form XML document. if ( ! ( $ this -> xml instanceof \ SimpleXMLElement ) ) { return $ fieldsets ; } if ( $ group ) { // Get the fields elements for a given group. $ elements = & $ this -> findGroup ( $ group ) ; foreach ( $ elements as & $ element ) { // Get an array of <fieldset /> elements and fieldset attributes within the fields element. if ( $ tmp = $ element -> xpath ( 'descendant::fieldset[@name] | descendant::field[@fieldset]/@fieldset' ) ) { $ sets = array_merge ( $ sets , ( array ) $ tmp ) ; } } } else { // Get an array of <fieldset /> elements and fieldset attributes. $ sets = $ this -> xml -> xpath ( '//fieldset[@name] | //field[@fieldset]/@fieldset' ) ; } // If no fieldsets are found return empty. if ( empty ( $ sets ) ) { return $ fieldsets ; } // Process each found fieldset. foreach ( $ sets as $ set ) { // Are we dealing with a fieldset element? if ( ( string ) $ set [ 'name' ] ) { // Only create it if it doesn't already exist. if ( empty ( $ fieldsets [ ( string ) $ set [ 'name' ] ] ) ) { // Build the fieldset object. $ fieldset = ( object ) array ( 'name' => '' , 'label' => '' , 'description' => '' ) ; foreach ( $ set -> attributes ( ) as $ name => $ value ) { $ fieldset -> $ name = ( string ) $ value ; } // Add the fieldset object to the list. $ fieldsets [ $ fieldset -> name ] = $ fieldset ; } } else // Must be dealing with a fieldset attribute. { // Only create it if it doesn't already exist. if ( empty ( $ fieldsets [ ( string ) $ set ] ) ) { // Attempt to get the fieldset element for data (throughout the entire form document). $ tmp = $ this -> xml -> xpath ( '//fieldset[@name="' . ( string ) $ set . '"]' ) ; // If no element was found, build a very simple fieldset object. if ( empty ( $ tmp ) ) { $ fieldset = ( object ) array ( 'name' => ( string ) $ set , 'label' => '' , 'description' => '' ) ; } else // Build the fieldset object from the element. { $ fieldset = ( object ) array ( 'name' => '' , 'label' => '' , 'description' => '' ) ; foreach ( $ tmp [ 0 ] -> attributes ( ) as $ name => $ value ) { $ fieldset -> $ name = ( string ) $ value ; } } // Add the fieldset object to the list. $ fieldsets [ $ fieldset -> name ] = $ fieldset ; } } } return $ fieldsets ; }
Method to get an array of fieldset objects optionally filtered over a given field group.

@param   string  $group  The dot-separated form group path on which to filter the fieldsets.

@return  array  The array of fieldset objects.

@since   1.0
Method to get an array of fieldset objects optionally filtered over a given field group .