diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-11-19 03:57:15 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-11-19 03:57:15 +0000 |
commit | bf703452de025483a9a8b8721068f28edcf81893 (patch) | |
tree | 9a1044831f7432198dcdec50e0f732358b3153a5 /modules/shortcut/shortcut.module | |
parent | fe9f2b9c965e22efec77e9a9b31c8996ff22cfa1 (diff) | |
download | brdo-bf703452de025483a9a8b8721068f28edcf81893.tar.gz brdo-bf703452de025483a9a8b8721068f28edcf81893.tar.bz2 |
#620634 by David_Rothstein: Don't build Shortcuts unconditionally for anonymous users.
Diffstat (limited to 'modules/shortcut/shortcut.module')
-rw-r--r-- | modules/shortcut/shortcut.module | 19 |
1 files changed, 18 insertions, 1 deletions
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' => '</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; } /** |