public function setup(SimpleXMLElement $element, $group = null)
{
// Make sure there is a valid JFormField XML element.
if ((string) $element->getName() != 'header') {
return false;
}
// Reset the internal fields
$this->label = null;
$this->header = null;
$this->filter = null;
$this->buttons = null;
$this->options = null;
$this->value = null;
$this->filterSource = null;
$this->filterFieldName = null;
// Set the XML element object.
$this->element = $element;
// Get some important attributes from the form field element.
$id = (string) $element['id'];
$name = (string) $element['name'];
$filterSource = (string) $element['filter_source'];
$filterFieldName = (string) $element['searchfieldname'];
$tdwidth = (string) $element['tdwidth'];
// Set the field description text.
$this->description = (string) $element['description'];
// Set the group of the field.
$this->group = $group;
// Set the td width of the field.
$this->tdwidth = $tdwidth;
// Set the field name and id.
$this->fieldname = $this->getFieldName($name);
$this->name = $this->getName($this->fieldname);
$this->id = $this->getId($id, $this->fieldname);
$this->filterSource = $this->getFilterSource($filterSource);
$this->filterFieldName = $this->getFilterFieldName($filterFieldName);
// Set the field default value.
$this->value = $this->getValue();
// Setup the onlyFilter property
$onlyFilter = $this->element['onlyFilter'] ? (string) $this->element['onlyFilter'] : false;
$this->onlyFilter = in_array($onlyFilter, array('yes', 'on', '1', 'true'));
return true;
}