public function inherited($route, $field = null)
    {
        if ($field !== null) {

            $page = $this->dispatch($route, true);

            $parent = $page ? $page->parent() : null;
            if ($parent && $parent->value('header.' . $field) !== null) {
                return $parent;
            }
            if ($parent && !$parent->root()) {
                return $this->inherited($parent->route(), $field);
            }
        }

        return null;
    }
public function inherited($route, $field = null)
    {
        if ($field !== null) {

            $page = $this->dispatch($route, true);

            $parent = $page ? $page->parent() : null;
            if ($parent && $parent->value('header.' . $field) !== null) {
                return $parent;
            }
            if ($parent && !$parent->root()) {
                return $this->inherited($parent->route(), $field);
            }
        }

        return null;
    }
public function inherited ( $ route , $ field = null ) { if ( $ field !== null ) { $ page = $ this -> dispatch ( $ route , true ) ; $ parent = $ page ? $ page -> parent ( ) : null ; if ( $ parent && $ parent -> value ( 'header.' . $ field ) !== null ) { return $ parent ; } if ( $ parent && ! $ parent -> root ( ) ) { return $ this -> inherited ( $ parent -> route ( ) , $ field ) ; } } return null ; }
Get a page ancestor trait.

@param  string $route The relative route of the page
@param  string $field The field name of the ancestor to query for

@return PageInterface|null
Get a page ancestor trait .