W3cubDocs

/Drupal 8

public function MenuLinkTreeInterface::build

public MenuLinkTreeInterface::build(array $tree)

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.

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

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Menu!MenuLinkTreeInterface.php/function/MenuLinkTreeInterface::build/8.1.x