function Drupal::menuTree

Same name and namespace in other branches
  1. 9 core/lib/Drupal.php \Drupal::menuTree()
  2. 8.9.x core/lib/Drupal.php \Drupal::menuTree()
  3. 10 core/lib/Drupal.php \Drupal::menuTree()

Returns the menu tree.

Return value

\Drupal\Core\Menu\MenuLinkTreeInterface The menu tree.

3 calls to Drupal::menuTree()
AdminTest::getTopLevelMenuLinks in core/modules/system/tests/src/Functional/System/AdminTest.php
Returns all top level menu links.
DrupalTest::testMenuTree in core/tests/Drupal/Tests/Core/DrupalTest.php
Tests the menuTree() method.
MenuLinkContentCacheabilityBubblingTest::testOutboundPathAndRouteProcessing in core/modules/menu_link_content/tests/src/Kernel/MenuLinkContentCacheabilityBubblingTest.php
Tests bubbleable metadata of menu links' outbound route/path processing.

File

core/lib/Drupal.php, line 685

Class

Drupal
Static Service Container wrapper.

Code

public static function menuTree() {
    return static::getContainer()->get('menu.link_tree');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.