FOF30\Form\Form::removeHeader PHP Method

removeHeader() public method

Method to remove a header from the form definition.
public removeHeader ( string $name, string $group = null ) : boolean
$name string The name of the form field for which remove.
$group string The optional dot-separated form group path on which to find the field.
return boolean True on success, false otherwise.
    public function removeHeader($name, $group = null)
    {
        // Make sure there is a valid JForm XML document.
        if (!$this->xml instanceof SimpleXMLElement) {
            throw new \UnexpectedValueException(sprintf('%s::getFieldAttribute `xml` is not an instance of SimpleXMLElement', get_class($this)));
        }
        // Find the form field element from the definition.
        $element = $this->findHeader($name, $group);
        // If the element exists remove it from the form definition.
        if ($element instanceof SimpleXMLElement) {
            $dom = dom_import_simplexml($element);
            $dom->parentNode->removeChild($dom);
            return true;
        }
        return false;
    }