function MenuLinkTreeInterface::build

Same name in other branches
  1. 9 core/lib/Drupal/Core/Menu/MenuLinkTreeInterface.php \Drupal\Core\Menu\MenuLinkTreeInterface::build()
  2. 10 core/lib/Drupal/Core/Menu/MenuLinkTreeInterface.php \Drupal\Core\Menu\MenuLinkTreeInterface::build()
  3. 11.x core/lib/Drupal/Core/Menu/MenuLinkTreeInterface.php \Drupal\Core\Menu\MenuLinkTreeInterface::build()

Builds a renderable array from a menu tree.

The menu item's LI element is given one of the following classes:

  • expanded: The menu item is showing its submenu.
  • collapsed: The menu item has a submenu that is not shown.
  • leaf: The menu item has no submenu.

Parameters

\Drupal\Core\Menu\MenuLinkTreeElement[] $tree: A data structure representing the tree, as returned from MenuLinkTreeInterface::load().

Return value

array A renderable array.

1 method overrides MenuLinkTreeInterface::build()
MenuLinkTree::build in core/lib/Drupal/Core/Menu/MenuLinkTree.php
Builds a renderable array from a menu tree.

File

core/lib/Drupal/Core/Menu/MenuLinkTreeInterface.php, line 94

Class

MenuLinkTreeInterface
Defines an interface for loading, transforming and rendering menu link trees.

Namespace

Drupal\Core\Menu

Code

public function build(array $tree);

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