Actions

API16

JForm/getFieldset

From Joomla! Documentation

< API16:JForm
Revision as of 04:59, 27 August 2010 by Haroldbr (Talk | contribs)

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.

Syntax

getFieldset()

Defined in

libraries/joomla/form/form.php

Importing

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;
}
</span>