shortcut_toolbar_pre_render

  1. drupal
    1. 8
    2. 7
Versions
7 – 8 shortcut_toolbar_pre_render($toolbar)

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

Code

modules/shortcut/shortcut.module, line 712

<?php
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;
}
?>