protected function loadHeader($element, $group = null)
{
// Make sure there is a valid SimpleXMLElement.
if (!$element instanceof \SimpleXMLElement) {
return false;
}
// Get the field type.
$type = $element['type'] ? (string) $element['type'] : 'field';
// Load the JFormField object for the field.
$field = $this->loadHeaderType($type);
// If the object could not be loaded, get a text field object.
if ($field === false) {
$field = $this->loadHeaderType('field');
}
// Setup the HeaderInterface object.
$field->setForm($this);
if ($field->setup($element, $group)) {
return $field;
} else {
return false;
}
}