public MenuLinkTree::transform(array $tree, array $manipulators)
Applies menu link tree manipulators to transform the given tree.
\Drupal\Core\Menu\MenuLinkTreeElement[] $tree: The menu tree to manipulate.
array $manipulators: The menu link tree manipulators to apply. Each is an array with keys:
\Drupal\Core\Menu\MenuLinkTreeElement[] The manipulated menu link tree.
Overrides MenuLinkTreeInterface::transform
public function transform(array $tree, array $manipulators) { foreach ($manipulators as $manipulator) { $callable = $manipulator['callable']; $callable = $this->controllerResolver->getControllerFromDefinition($callable); // Prepare the arguments for the menu tree manipulator callable; the first // argument is always the menu link tree. if (isset($manipulator['args'])) { array_unshift($manipulator['args'], $tree); $tree = call_user_func_array($callable, $manipulator['args']); } else { $tree = call_user_func($callable, $tree); } } return $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!MenuLinkTree.php/function/MenuLinkTree::transform/8.1.x