Implements hook_toolbar().
function shortcut_toolbar() {
$items = array();
$links = shortcut_renderable_links();
$shortcut_set = shortcut_current_displayed_set();
$configure_link = NULL;
if (shortcut_set_edit_access($shortcut_set)) {
$configure_link = array(
'#type' => 'link',
'#title' => t('Edit shortcuts'),
'#href' => 'admin/config/user-interface/shortcut/manage/' . $shortcut_set
->id(),
'#options' => array(
'attributes' => array(
'class' => array(
'edit-shortcuts',
),
),
),
);
}
if (!empty($links) || !empty($configure_link)) {
$items['shortcuts'] = array(
'#type' => 'toolbar_item',
'tab' => array(
'#type' => 'link',
'#title' => t('Shortcuts'),
'#href' => 'admin/config/user-interface/shortcut',
'#options' => array(
'attributes' => array(
'title' => t('Shortcuts'),
'class' => array(
'icon',
'icon-shortcut',
),
),
),
),
'tray' => array(
'#heading' => t('User-defined shortcuts'),
'shortcuts' => $links,
'configure' => $configure_link,
),
'#weight' => -10,
'#attached' => array(
'css' => array(
drupal_get_path('module', 'shortcut') . '/css/shortcut.module.css',
drupal_get_path('module', 'shortcut') . '/css/shortcut.theme.css',
),
),
);
}
return $items;
}