From bf703452de025483a9a8b8721068f28edcf81893 Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Thu, 19 Nov 2009 03:57:15 +0000 Subject: #620634 by David_Rothstein: Don't build Shortcuts unconditionally for anonymous users. --- modules/shortcut/shortcut.module | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'modules/shortcut/shortcut.module') diff --git a/modules/shortcut/shortcut.module b/modules/shortcut/shortcut.module index 9d7f18e46..894d0c060 100644 --- a/modules/shortcut/shortcut.module +++ b/modules/shortcut/shortcut.module @@ -554,7 +554,23 @@ function shortcut_page_build(&$page) { '#suffix' => '', ); } +} + +/** + * 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'] = '
'; @@ -575,7 +591,8 @@ function shortcut_page_build(&$page) { 'configure' => $configure_link, ); - $page['toolbar_drawer'] = $drawer; + $toolbar['toolbar_drawer'][] = $drawer; + return $toolbar; } /** -- cgit v1.2.3