You are here

public function MenuTreeStorage::loadSubtreeData in Colossal Menu 8

Same name and namespace in other branches
  1. 2.x src/Menu/MenuTreeStorage.php \Drupal\colossal_menu\Menu\MenuTreeStorage::loadSubtreeData()

Loads a subtree rooted by the given ID.

The returned links are structured like those from loadTreeData().

Parameters

string $id: The menu link plugin ID.

int $max_relative_depth: (optional) The maximum depth of child menu links relative to the passed in. Defaults to NULL, in which case the full subtree will be returned.

Return value

array An array with 2 elements:

  • subtree: A fully built menu tree element or FALSE.
  • route_names: An array of all route names used in the subtree.

Overrides MenuTreeStorageInterface::loadSubtreeData

File

src/Menu/MenuTreeStorage.php, line 301

Class

MenuTreeStorage
Provides a menu tree storage using the database.

Namespace

Drupal\colossal_menu\Menu

Code

public function loadSubtreeData($id, $max_relative_depth = NULL) {
  $link = $this
    ->load($id);
  $params = new MenuTreeParameters();
  $params->root = $id;
  $params
    ->setMaxDepth($max_relative_depth);
  return $this
    ->loadTreeData($link
    ->getMenuName(), $params);
}