public static function WorkbenchToolbar::preRenderTray in Workbench 8
Render the Workbench toolbar tray.
Parameters
array $element: The tray render array.
Return value
array The tray render array with the Workbench items added.
See also
toolbar_prerender_toolbar_administration_tray()
File
- src/
Render/ Element/ WorkbenchToolbar.php, line 32
Class
- WorkbenchToolbar
- Generates the toolbar elements for Workbench.
Namespace
Drupal\workbench\Render\ElementCode
public static function preRenderTray(array $element) {
$menu_tree = \Drupal::service('toolbar.menu_tree');
$parameters = new MenuTreeParameters();
$parameters
->setMinDepth(1)
->setMaxDepth(1);
$tree = $menu_tree
->load('workbench', $parameters);
$manipulators = [
[
'callable' => 'menu.default_tree_manipulators:checkAccess',
],
[
'callable' => 'menu.default_tree_manipulators:generateIndexAndSort',
],
[
'callable' => 'toolbar_menu_navigation_links',
],
];
$tree = $menu_tree
->transform($tree, $manipulators);
$element['administration_menu'] = $menu_tree
->build($tree);
return $element;
}