FOF30\Form\Form::getHeader PHP Method

getHeader() public method

Method to get a header field represented as a HeaderInterface object.
Since: 2.0
public getHeader ( string $name, string $group = null, mixed $value = null ) : FOF30\Form\HeaderInterface | boolean
$name string The name of the header field.
$group string The optional dot-separated form group path on which to find the field.
$value mixed The optional value to use as the default for the field. (DEPRECATED)
return FOF30\Form\HeaderInterface | boolean The HeaderInterface object for the field or boolean false on error.
    public function getHeader($name, $group = null, $value = null)
    {
        // Make sure there is a valid Form XML document.
        if (!$this->xml instanceof \SimpleXMLElement) {
            return false;
        }
        // Attempt to find the field by name and group.
        $element = $this->findHeader($name, $group);
        // If the field element was not found return false.
        if (!$element) {
            return false;
        }
        return $this->loadHeader($element, $group);
    }