Get top parent menu of current menu item

@return TopMenuItem|null
483368
public function getLowestTopChild()
    {
        $current = $this->getCurrent();
        while (!is_null($current)) {
            if ($current instanceof TopMenuItem) {
                return $current;
            }
            $current = $current->getParent();
        }

        return null;
    }
274979
public function getChildren(MenuItem $parent = null)
    {
        if ($parent === null) {
            return $this->getTopChildren();
        }
        /* @var $request Request */
        $request = $this->container->get('request_stack')->getCurrentRequest();
        $result = array();
        foreach ($this->getAdaptors() as $menuAdaptor) {
            $menuAdaptor->adaptChildren($this, $result, $parent, $request);
        }

        return $result;
    }
927529
public function getParent()
    {
        return $this->BaseClass && $this->ParentID
            ? DataObject::get_by_id($this->BaseClass, $this->ParentID, true)
            : null;
    }
1084688
public function getParentClass()
    {
        $parentClass  = parent::getParentClass();
        if (null === $parentClass || false === $parentClass) {
            return null;
        }
        
        $moufRefClass = new self($parentClass->getName());
        return $moufRefClass;
    }
915824
public function getTopChildren()
    {
        $result = [];
        $children = $this->getChildren();
        foreach ($children as $child) {
            if ($child instanceof TopMenuItem) {
                $result[] = $child;
            }
        }

        return $result;
    }
508678
public function getParent()
    {
        $sParent = $this->getInfo('parentTheme');
        if (!$sParent) {
            return null;
        }
        $oTheme = oxNew(\OxidEsales\Eshop\Core\Theme::class);
        if ($oTheme->load($sParent)) {
            return $oTheme;
        }

        return null;
    }
11564
public function getParentNode()
    {
        if (!$this->parentNode) {
            throw new \RuntimeException(sprintf(
                'Trying to retrieve parent node when no parent node has been set. An event ' .
                'listener should have set the node when persisting document "%s"',
                DocumentHelper::getDebugTitle($this->document)
            ));
        }

        return $this->parentNode;
    }
674575
public static function get_top_level_parent_id($post = null)
    {
        if (\is_search() || \is_404()) {
            return null;
        }

        switch ($post) {
            // No post has been set, so use global.
            case null:
                global $post;

            // The post ID has been provided.
            case \is_int($post):
                $post = \get_post($post);

            // A WP_Post was provided.
            case \is_object($post):
                $ancestors = $post->ancestors;
                break;

            case \is_array($post):
                $ancestors = $post['ancestors'];
                break;
        }

        if (isset($ancestors) && ! empty($ancestors)) {
            return (int) \end($ancestors);
        } else {
            return (int) $post->ID;
        }
    }
545488
protected function getParentClasspath()
    {
        if ($this->getChild()->getAncestor()) {
            return $this->getChild()->getAncestor();
        } else {
            return $this->getObjectBuilder()->getClasspath();
        }
    }
428783
protected function getMenuList()
    {
        $links = $this->menu->getMenuList();

        $links->addParameterSources($this->request, $this->menu->getParameterSource());
        $links->addCurrentParent($this->_('Cancel'));

        if ($this->menuShowSiblings) {
            $links->addCurrentSiblings();
        }

        if ($this->menuShowChildren) {
            $links->addCurrentChildren();
        }

        return $links;
    }
828390
public function getBestTarget()
    {
        if ($this->hasParent() && ($this->target == '' || $this->target == '#')) {
            return $this->parent->getBestTarget();
        }
        
        return $this->target;
    }
211067
public function getParentKey()
    {
        if ($this->owner->isRoot()) {
            return null;
        }
        $path = $this->getPath();
        return array_pop($path);
    }
318802
public static function getMenuList()
    {
        $menus = get_terms('nav_menu');

        if (! isset($menus) && empty($menus)) {
            return;
        }

        $menuList = array();

        foreach ($menus as $menu) {
            $menuList[] = $menu->name;
        }

        return $menus;
    }
1110968
public function mainMenu()
    {
        if ($this->mainMenu === null) {
            $options = null;

            if ($this instanceof DashboardContainerInterface) {
                $dashboardConfig = $this->dashboardConfig();

                if (isset($dashboardConfig['secondary_menu'])) {
                    $options = $dashboardConfig['secondary_menu'];
                }
            }

            $this->mainMenu = $this->createMainMenu($options);
        }

        return $this->mainMenu;
    }
718650
public function getActiveMainMenuItem()
    {
        foreach ($this->listMainMenuItems() as $item) {
            if ($this->isMainMenuItemActive($item)) {
                return $item;
            }
        }

        return null;
    }
0
protected function parentId()
	{
		switch ( $this->position )
		{
			case 'root':
				return null;

			case 'child':
				return $this->target->getKey();

			default:
				return $this->target->getParentId();
		}
	}
958756
public function getChilds()
    {
        if (config('menus.ordering')) {
            return collect($this->childs)->sortBy(function ($child) {
                return $child->order;
            })->all();
        }

        return $this->childs;
    }