summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/shortcut/shortcut.module19
-rw-r--r--modules/toolbar/toolbar.module2
2 files changed, 19 insertions, 2 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;
}
/**
diff --git a/modules/toolbar/toolbar.module b/modules/toolbar/toolbar.module
index bbfa5b96d..b6c473912 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(),
);
}