FALSE)); // Performance: Defer execution. drupal_add_js($path . '/admin_menu_toolbar.js', array('defer' => TRUE)); $settings = array(); // Add current path to support menu item highlighting. // @todo Compile real active trail here? $args = explode('/', $_GET['q']); if ($args[0] == 'admin' && !empty($args[1])) { $settings['activeTrail'] = url($args[0] . '/' . $args[1]); } elseif (drupal_is_front_page()) { $settings['activeTrail'] = url(''); } drupal_add_js(array('admin_menu' => array('toolbar' => $settings)), 'setting'); } /** * Implementation of hook_admin_menu_output_alter(). */ function admin_menu_toolbar_admin_menu_output_alter(&$content) { // Add a class to top-level items for styling. foreach (element_children($content['menu']) as $link) { $content['menu'][$link]['#attributes']['class'][] = 'admin-menu-toolbar-category'; } // Alter icon. unset($content['icon']['icon']['#theme']); $content['icon']['icon']['#title'] = '' . t('Home') . ''; $content['icon']['icon']['#attributes']['class'][] = 'admin-menu-toolbar-category'; // Alter user account link. $content['user']['account']['#title'] = t('Hello @username', array('@username' => $content['user']['account']['#title'])); $content['user']['account']['#options']['html'] = TRUE; // Add shortcuts menu. $content['shortcuts'] = array( '#theme' => 'admin_menu_links', '#weight' => -200, ); $content['shortcuts']['shortcuts'] = array( '#title' => t('Show shortcuts'), // @todo How do we want to trigger/store state? '#attributes' => array('class' => array('admin-menu-shortcuts')), //'#attributes' => array('class' => array('admin-menu-shortcuts', 'admin-menu-shortcuts-active')), '#options' => array( 'attributes' => array('class' => 'toggle'), ), ); // @todo *Move* this from $content['menu'] instead. $content['shortcuts']['shortcuts']['node-add'] = array( '#title' => t('Add content'), '#href' => 'node/add', ); $content['shortcuts']['shortcuts']['admin-content-node'] = array( '#title' => t('Find content'), '#href' => 'admin/content/node', '#access' => user_access('administer nodes'), ); }