Commit bf703452 authored by webchick's avatar webchick
Browse files

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

parent fe9f2b9c
......@@ -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;
}
/**
......
......@@ -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(),
);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment