#620634 by David_Rothstein: Don't build Shortcuts unconditionally for anonymous users.

merge-requests/26/head
Angie Byron 2009-11-19 03:57:15 +00:00
parent fe9f2b9c96
commit bf703452de
2 changed files with 19 additions and 2 deletions

View File

@ -554,7 +554,23 @@ function shortcut_page_build(&$page) {
'#suffix' => '</div>',
);
}
}
/**
* Implements hook_page_alter().
*/
function shortcut_page_alter(&$page) {
if (isset($page['page_top']['toolbar'])) {
// If the toolbar is available, add a pre-render function to display the
// current shortcuts in the toolbar drawer.
$page['page_top']['toolbar']['#pre_render'][] = 'shortcut_toolbar_pre_render';
}
}
/**
* Pre-render function for adding shortcuts to the toolbar drawer.
*/
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">';
@ -575,7 +591,8 @@ function shortcut_page_build(&$page) {
'configure' => $configure_link,
);
$page['toolbar_drawer'] = $drawer;
$toolbar['toolbar_drawer'][] = $drawer;
return $toolbar;
}
/**

View File

@ -105,7 +105,7 @@ function toolbar_page_build(&$page) {
$page['page_top']['toolbar'] = array(
'#pre_render' => array('toolbar_pre_render'),
'#access' => user_access('access toolbar'),
'toolbar_drawer' => isset($page['toolbar_drawer']) ? $page['toolbar_drawer'] : array(),
'toolbar_drawer' => array(),
);
}