You are here

function shortcut_toolbar_pre_render in Drupal 7

Pre-render function for adding shortcuts to the toolbar drawer.

1 string reference to 'shortcut_toolbar_pre_render'
shortcut_page_alter in modules/shortcut/shortcut.module
Implements hook_page_alter().

File

modules/shortcut/shortcut.module, line 712
Allows users to manage customizable lists of shortcut links.

Code

function shortcut_toolbar_pre_render($toolbar) {
  $links = shortcut_renderable_links();
  $links['#attached'] = array(
    'css' => array(
      drupal_get_path('module', 'shortcut') . '/shortcut.css',
    ),
  );
  $links['#prefix'] = '<div class="toolbar-shortcuts">';
  $links['#suffix'] = '</div>';
  $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/' . $shortcut_set->set_name,
      '#options' => array(
        'attributes' => array(
          'id' => 'edit-shortcuts',
        ),
      ),
    );
  }
  $drawer = array(
    'shortcuts' => $links,
    'configure' => $configure_link,
  );
  $toolbar['toolbar_drawer'][] = $drawer;
  return $toolbar;
}