public function SocialAdminMenuAdministratorMenuLinkTreeManipulators::renderForm in Open Social 8
Same name and namespace in other branches
- 8.9 modules/custom/social_admin_menu/src/Menu/SocialAdminMenuAdministratorMenuLinkTreeManipulators.php \Drupal\social_admin_menu\Menu\SocialAdminMenuAdministratorMenuLinkTreeManipulators::renderForm()
- 8.2 modules/custom/social_admin_menu/src/Menu/SocialAdminMenuAdministratorMenuLinkTreeManipulators.php \Drupal\social_admin_menu\Menu\SocialAdminMenuAdministratorMenuLinkTreeManipulators::renderForm()
- 8.3 modules/custom/social_admin_menu/src/Menu/SocialAdminMenuAdministratorMenuLinkTreeManipulators.php \Drupal\social_admin_menu\Menu\SocialAdminMenuAdministratorMenuLinkTreeManipulators::renderForm()
- 8.4 modules/custom/social_admin_menu/src/Menu/SocialAdminMenuAdministratorMenuLinkTreeManipulators.php \Drupal\social_admin_menu\Menu\SocialAdminMenuAdministratorMenuLinkTreeManipulators::renderForm()
- 8.5 modules/custom/social_admin_menu/src/Menu/SocialAdminMenuAdministratorMenuLinkTreeManipulators.php \Drupal\social_admin_menu\Menu\SocialAdminMenuAdministratorMenuLinkTreeManipulators::renderForm()
- 8.6 modules/custom/social_admin_menu/src/Menu/SocialAdminMenuAdministratorMenuLinkTreeManipulators.php \Drupal\social_admin_menu\Menu\SocialAdminMenuAdministratorMenuLinkTreeManipulators::renderForm()
- 8.7 modules/custom/social_admin_menu/src/Menu/SocialAdminMenuAdministratorMenuLinkTreeManipulators.php \Drupal\social_admin_menu\Menu\SocialAdminMenuAdministratorMenuLinkTreeManipulators::renderForm()
- 8.8 modules/custom/social_admin_menu/src/Menu/SocialAdminMenuAdministratorMenuLinkTreeManipulators.php \Drupal\social_admin_menu\Menu\SocialAdminMenuAdministratorMenuLinkTreeManipulators::renderForm()
- 10.3.x modules/custom/social_admin_menu/src/Menu/SocialAdminMenuAdministratorMenuLinkTreeManipulators.php \Drupal\social_admin_menu\Menu\SocialAdminMenuAdministratorMenuLinkTreeManipulators::renderForm()
- 10.0.x modules/custom/social_admin_menu/src/Menu/SocialAdminMenuAdministratorMenuLinkTreeManipulators.php \Drupal\social_admin_menu\Menu\SocialAdminMenuAdministratorMenuLinkTreeManipulators::renderForm()
- 10.1.x modules/custom/social_admin_menu/src/Menu/SocialAdminMenuAdministratorMenuLinkTreeManipulators.php \Drupal\social_admin_menu\Menu\SocialAdminMenuAdministratorMenuLinkTreeManipulators::renderForm()
- 10.2.x modules/custom/social_admin_menu/src/Menu/SocialAdminMenuAdministratorMenuLinkTreeManipulators.php \Drupal\social_admin_menu\Menu\SocialAdminMenuAdministratorMenuLinkTreeManipulators::renderForm()
Renders the toolbar's administration tray.
This is a adoption of core's toolbar_prerender_toolbar_administration_tray() function, which uses setMaxDepth(4) instead of setTopLevelOnly()
Return value
array The updated renderable array.
See also
admin_toolbar_prerender_toolbar_administration_tray()
File
- modules/
custom/ social_admin_menu/ src/ Menu/ SocialAdminMenuAdministratorMenuLinkTreeManipulators.php, line 113
Class
- SocialAdminMenuAdministratorMenuLinkTreeManipulators
- Provides a couple of menu link tree manipulators.
Namespace
Drupal\social_admin_menu\MenuCode
public function renderForm() {
$menu_tree = \Drupal::service('toolbar.menu_tree');
$parameters = new MenuTreeParameters();
$parameters
->setRoot('system.admin')
->excludeRoot()
->setMaxDepth(4)
->onlyEnabledLinks();
$manipulators = [
[
'callable' => 'menu.default_tree_manipulators:checkAccess',
],
[
'callable' => 'menu.default_tree_manipulators:generateIndexAndSort',
],
[
'callable' => 'toolbar_tools_menu_navigation_links',
],
[
'callable' => 'social_admin_menu.administrator_menu_tree_manipulators:checkAccess',
],
];
$tree = $menu_tree
->load(NULL, $parameters);
$tree = $menu_tree
->transform($tree, $manipulators);
$element['administration_menu'] = $menu_tree
->build($tree);
$element['administration_menu']['#cache']['contexts'][] = 'user.roles';
return $element;
}