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

Returns the menu tree.

Return value

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

11 calls to Drupal::menuTree()
AdminTest::getTopLevelMenuLinks in core/modules/system/tests/src/Functional/System/AdminTest.php
Returns all top level menu links.
DisplayPageTest::testMenuLinks in core/modules/views/tests/src/Kernel/Plugin/DisplayPageTest.php
Tests the generated menu links of views.
DisplayPathTest::testDefaultMenuTabRegression in core/modules/views_ui/tests/src/Functional/DisplayPathTest.php
Tests the regression in https://www.drupal.org/node/2532490.
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.

... See full list

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');
}