/Drupal 8

class MenuTreeParameters

Provides a value object to model menu tree parameters.

Menu tree parameters are used to determine the set of definitions to be loaded from \Drupal\Core\Menu\MenuTreeStorageInterface. Hence they determine the shape and content of the tree:

  • Which parent IDs should be used to restrict the tree. Only links with a parent in the list will be included.
  • Which menu links are omitted, depending on the minimum and maximum depth.



core/lib/Drupal/Core/Menu/MenuTreeParameters.php, line 15




Name Modifiers Type Description
MenuTreeParameters::$activeTrail public property The IDs from the currently active menu link to the root of the whole tree.
MenuTreeParameters::$conditions public property The conditions used to restrict which links are loaded.
MenuTreeParameters::$expandedParents public property An array of parent link IDs.
MenuTreeParameters::$maxDepth public property The maximum depth of menu links in the resulting tree relative to the root.
MenuTreeParameters::$minDepth public property The minimum depth of menu links in the resulting tree relative to the root.
MenuTreeParameters::$root public property A menu link plugin ID that should be used as the root.
MenuTreeParameters::addCondition public function Adds a custom query condition.
MenuTreeParameters::addExpandedParents public function Adds parent menu links IDs to restrict the tree.
MenuTreeParameters::excludeRoot public function Excludes the root menu link from the tree.
MenuTreeParameters::onlyEnabledLinks public function Excludes links that are not enabled.
MenuTreeParameters::setActiveTrail public function Sets the active trail IDs used to set the inActiveTrail property.
MenuTreeParameters::setMaxDepth public function Sets a maximum depth for menu tree loading.
MenuTreeParameters::setMinDepth public function Sets a minimum depth for menu tree loading.
MenuTreeParameters::setRoot public function Sets a root for menu tree loading.
MenuTreeParameters::setTopLevelOnly public function Ensures only the top level of the tree is loaded.

© 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.