You are here

public function MenuTreeStorageInterface::loadTreeData in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Menu/MenuTreeStorageInterface.php \Drupal\Core\Menu\MenuTreeStorageInterface::loadTreeData()
  2. 9 core/lib/Drupal/Core/Menu/MenuTreeStorageInterface.php \Drupal\Core\Menu\MenuTreeStorageInterface::loadTreeData()

Loads a menu link tree from the storage.

This function may be used build the data for a menu tree only, for example to further massage the data manually before further processing happens. MenuLinkTree::checkAccess() needs to be invoked afterwards.

The tree order is maintained using an optimized algorithm, for example by storing each parent in an individual field, see https://www.drupal.org/node/141866 for more details. However, any details of the storage should not be relied upon since it may be swapped with a different implementation.

Parameters

string $menu_name: The name of the menu.

\Drupal\Core\Menu\MenuTreeParameters $parameters: The parameters to determine which menu links to be loaded into a tree.

Return value

array An array with 2 elements:

  • tree: A fully built menu tree containing an array. @see static::treeDataRecursive()
  • route_names: An array of all route names used in the tree.

File

core/lib/Drupal/Core/Menu/MenuTreeStorageInterface.php, line 143

Class

MenuTreeStorageInterface
Defines an interface for storing a menu tree containing menu link IDs.

Namespace

Drupal\Core\Menu

Code

public function loadTreeData($menu_name, MenuTreeParameters $parameters);