src/Page/Page.php
protected function findParentHook(): string
    {
        if (! $this->hasParent()) {
            return '';
        }

        // Check if parent attribute is attached to a custom post type or another page.
        if (false !== $pos = strpos($this->getParent(), 'post_type=')) {
            // Parent hook is equivalent to the post type slug value.
            return substr($this->getParent(), $pos + 10);
        } elseif ('edit.php' === trim($this->getParent(), '\/?&')) {
            // Parent is the default post post type.
            return 'posts';
        }

        // The current page is attached to another one.
        $abstract = 'page.'.$this->getParent();

        if ($this->ui()->factory()->getContainer()->bound($abstract)) {
            // Parent hook is equivalent to the page menu as lowercase.
            $parent = $this->ui()->factory()->getContainer()->make($abstract);

            return strtolower($parent->getMenu());
        }

        return '';
    }
protected function findParentHook(): string
    {
        if (! $this->hasParent()) {
            return '';
        }

        // Check if parent attribute is attached to a custom post type or another page.
        if (false !== $pos = strpos($this->getParent(), 'post_type=')) {
            // Parent hook is equivalent to the post type slug value.
            return substr($this->getParent(), $pos + 10);
        } elseif ('edit.php' === trim($this->getParent(), '\/?&')) {
            // Parent is the default post post type.
            return 'posts';
        }

        // The current page is attached to another one.
        $abstract = 'page.'.$this->getParent();

        if ($this->ui()->factory()->getContainer()->bound($abstract)) {
            // Parent hook is equivalent to the page menu as lowercase.
            $parent = $this->ui()->factory()->getContainer()->make($abstract);

            return strtolower($parent->getMenu());
        }

        return '';
    }
protected function findParentHook ( ) : string { if ( ! $ this -> hasParent ( ) ) { return '' ; } // Check if parent attribute is attached to a custom post type or another page. if ( false !== $ pos = strpos ( $ this -> getParent ( ) , 'post_type=' ) ) { // Parent hook is equivalent to the post type slug value. return substr ( $ this -> getParent ( ) , $ pos + 10 ) ; } elseif ( 'edit.php' === trim ( $ this -> getParent ( ) , '\/?&' ) ) { // Parent is the default post post type. return 'posts' ; } // The current page is attached to another one. $ abstract = 'page.' . $ this -> getParent ( ) ; if ( $ this -> ui ( ) -> factory ( ) -> getContainer ( ) -> bound ( $ abstract ) ) { // Parent hook is equivalent to the page menu as lowercase. $ parent = $ this -> ui ( ) -> factory ( ) -> getContainer ( ) -> make ( $ abstract ) ; return strtolower ( $ parent -> getMenu ( ) ) ; } return '' ; }
Find the page parent hook if any.

@return string
Find the page parent hook if any .