public function ToolbarHandler::lazyBuilder in Devel 8
Same name and namespace in other branches
- 8.3 src/ToolbarHandler.php \Drupal\devel\ToolbarHandler::lazyBuilder()
- 8.2 src/ToolbarHandler.php \Drupal\devel\ToolbarHandler::lazyBuilder()
- 4.x src/ToolbarHandler.php \Drupal\devel\ToolbarHandler::lazyBuilder()
Lazy builder callback for the devel menu toolbar.
Return value
array The renderable array rapresentation of the devel menu.
File
- src/
ToolbarHandler.php, line 135
Class
- ToolbarHandler
- Toolbar integration handler.
Namespace
Drupal\develCode
public function lazyBuilder() {
$parameters = new MenuTreeParameters();
$parameters
->onlyEnabledLinks()
->setTopLevelOnly();
$tree = $this->menuLinkTree
->load('devel', $parameters);
$manipulators = [
[
'callable' => 'menu.default_tree_manipulators:checkAccess',
],
[
'callable' => 'menu.default_tree_manipulators:generateIndexAndSort',
],
[
'callable' => ToolbarHandler::class . ':processTree',
],
];
$tree = $this->menuLinkTree
->transform($tree, $manipulators);
$build = $this->menuLinkTree
->build($tree);
CacheableMetadata::createFromRenderArray($build)
->addCacheableDependency($this->config)
->applyTo($build);
return $build;
}