Difference between revisions of "JForm/getFieldset"

From Joomla! Documentation

< API16:JForm
(Source Body)
Line 43: Line 43:
return $fields;
return $fields;

Revision as of 05:00, 27 August 2010

Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.



Defined in



jimport( 'joomla.form.form' );

Source Body

public function getFieldset($set = null)
	// Initialize variables.
	$fields = array();
	// Get all of the field elements in the fieldset.
	if ($set) {
		$elements = $this->findFieldsByFieldset($set);
	// Get all fields.
	else {
		$elements = $this->findFieldsByGroup();
	// If no field elements were found return empty.
	if (empty($elements)) {
		return $fields;
	// Build the result array from the found field elements.
	foreach ($elements as $element) {
		// Get the field groups for the element.
		$attrs	= $element->xpath('ancestor::fields[@name]/@name');
		$groups	= array_map('strval', $attrs ? $attrs : array());
		$group	= implode('.', $groups);
		// If the field is successfully loaded add it to the result array.
		if ($field = $this->loadField($element, $group)) {
			$fields[$field->id] = $field;
	return $fields;