function admin_menu_toolbar_page_build in Administration menu 8.3
Same name and namespace in other branches
- 7.3 admin_menu_toolbar/admin_menu_toolbar.module \admin_menu_toolbar_page_build()
Implementation of hook_page_build().
File
- admin_menu_toolbar/
admin_menu_toolbar.module, line 57 - Renders Administration menu like Toolbar (core) module.
Code
function admin_menu_toolbar_page_build(&$page) {
if (!isset($page['page_bottom']['admin_menu'])) {
return;
}
$attached =& $page['page_bottom']['admin_menu']['#attached'];
$attached['library'][] = [
'admin_menu_toolbar',
'drupal.admin',
];
$settings = [];
// Add current path to support menu item highlighting.
// @todo Compile real active trail here?
$args = arg();
if ($args[0] == 'admin' && !empty($args[1])) {
$settings['activeTrail'] = url($args[0] . '/' . $args[1]);
}
elseif (drupal_is_front_page()) {
$settings['activeTrail'] = url('<front>');
}
$attached['js'][] = [
'data' => [
'admin_menu' => [
'toolbar' => $settings,
],
],
'type' => 'setting',
];
}