public function pageHeaderVarFunc($var, $pages = null)
    {
        if ($pages === null) {
            $pages = $this->grav['page'];
        }

        // Make sure pages are an array
        if (!\is_array($pages)) {
            $pages = [$pages];
        }

        // Loop over pages and look for header vars
        foreach ($pages as $page) {
            if (\is_string($page)) {
                $page = $this->grav['pages']->find($page);
            }

            if ($page) {
                $header = $page->header();
                if (isset($header->{$var})) {
                    return $header->{$var};
                }
            }
        }

        return null;
    }
public function pageHeaderVarFunc($var, $pages = null)
    {
        if ($pages === null) {
            $pages = $this->grav['page'];
        }

        // Make sure pages are an array
        if (!\is_array($pages)) {
            $pages = [$pages];
        }

        // Loop over pages and look for header vars
        foreach ($pages as $page) {
            if (\is_string($page)) {
                $page = $this->grav['pages']->find($page);
            }

            if ($page) {
                $header = $page->header();
                if (isset($header->{$var})) {
                    return $header->{$var};
                }
            }
        }

        return null;
    }
public function pageHeaderVarFunc ( $ var , $ pages = null ) { if ( $ pages === null ) { $ pages = $ this -> grav [ 'page' ] ; } // Make sure pages are an array if ( ! \ is_array ( $ pages ) ) { $ pages = [ $ pages ] ; } // Loop over pages and look for header vars foreach ( $ pages as $ page ) { if ( \ is_string ( $ page ) ) { $ page = $ this -> grav [ 'pages' ] -> find ( $ page ) ; } if ( $ page ) { $ header = $ page -> header ( ) ; if ( isset ( $ header -> { $ var } ) ) { return $ header -> { $ var } ; } } } return null ; }
Look for a page header variable in an array of pages working its way through until a value is found

@param string $var
@param string|string[]|null $pages
@return mixed
Look for a page header variable in an array of pages working its way through until a value is found