diff --git a/modules/shortcut/shortcut.module b/modules/shortcut/shortcut.module index 9d7f18e468a6c9a0a9684bd29869aa9f3b427a42..894d0c06096879a452219057d21b4a7942b054b4 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; } /** diff --git a/modules/toolbar/toolbar.module b/modules/toolbar/toolbar.module index bbfa5b96dbb67188f6c5700fe884a8e776f1d403..b6c473912005946cecc68e91860c84f77d736431 100644 --- a/modules/toolbar/toolbar.module +++ b/modules/toolbar/toolbar.module @@ -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(), ); }