public function getLevel()
    {
        if ($page = $this->getCurrentPage(Page::class)) {
            
            if (!$page->Children()->exists()) {
                
                $parent = $page->getParent();
                
                while ($parent && !$parent->Children()->exists()) {
                    $parent = $parent->getParent();
                }
                
                return $parent;
                
            }
            
            return $page;
            
        }
    }
public function getLevel()
    {
        if ($page = $this->getCurrentPage(Page::class)) {
            
            if (!$page->Children()->exists()) {
                
                $parent = $page->getParent();
                
                while ($parent && !$parent->Children()->exists()) {
                    $parent = $parent->getParent();
                }
                
                return $parent;
                
            }
            
            return $page;
            
        }
    }
public function getLevel ( ) { if ( $ page = $ this -> getCurrentPage ( Page :: class ) ) { if ( ! $ page -> Children ( ) -> exists ( ) ) { $ parent = $ page -> getParent ( ) ; while ( $ parent && ! $ parent -> Children ( ) -> exists ( ) ) { $ parent = $ parent -> getParent ( ) ; } return $ parent ; } return $ page ; } }
Answers the page object at the current level.

@return SiteTree
Answers the page object at the current level .