summaryrefslogtreecommitdiff
path: root/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu_toolbar/admin_menu_toolbar.module
diff options
context:
space:
mode:
authorTorsten Grote <grote@kolabsys.com>2014-01-23 14:16:54 (GMT)
committerTorsten Grote <grote@kolabsys.com>2014-01-23 14:16:54 (GMT)
commit9ec77367e92d9c9dd55f6b4f3d88b09f18e56b49 (patch)
tree301223a76d554f5c61a849534e1c52922a2fd984 /kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu_toolbar/admin_menu_toolbar.module
parentf2e198d9dc13020ac2307d2e58cfc9b650a1ecec (diff)
downloadkolab.org-www-9ec77367e92d9c9dd55f6b4f3d88b09f18e56b49.tar.gz
bring most modules up to date
Diffstat (limited to 'kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu_toolbar/admin_menu_toolbar.module')
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu_toolbar/admin_menu_toolbar.module34
1 files changed, 27 insertions, 7 deletions
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu_toolbar/admin_menu_toolbar.module b/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu_toolbar/admin_menu_toolbar.module
index 1885fce..74a9ee1 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu_toolbar/admin_menu_toolbar.module
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/admin_menu/admin_menu_toolbar/admin_menu_toolbar.module
@@ -8,6 +8,17 @@
*/
/**
+ * Implements hook_form_FORMID_alter().
+ */
+function admin_menu_toolbar_form_admin_menu_theme_settings_alter(&$form) {
+ // Add the shortcut links as component on behalf of Shortcut module.
+ $form['plugins']['admin_menu_components']['#options']['shortcut.links'] = t('Shortcuts');
+ // The shortcut bar consists of two elements, so we target their class names
+ // instead of cluttering the markup with additional IDs.
+ $form['plugins']['admin_menu_components']['shortcut.links']['#attributes']['rel'] = '.shortcut-toggle, .shortcut-toolbar';
+}
+
+/**
* Implementation of hook_page_build().
*/
function admin_menu_toolbar_page_build(&$page) {
@@ -48,6 +59,9 @@ function admin_menu_toolbar_page_build(&$page) {
* Implements hook_admin_menu_output_build().
*/
function admin_menu_toolbar_admin_menu_output_build(&$content) {
+ if (empty($content['#components']['shortcut.links']) && !$content['#complete']) {
+ return;
+ }
// Add shortcuts toggle.
$content['shortcut-toggle'] = array(
'#access' => module_exists('shortcut'),
@@ -82,17 +96,23 @@ function admin_menu_toolbar_admin_menu_output_build(&$content) {
*/
function admin_menu_toolbar_admin_menu_output_alter(&$content) {
// Add a class to top-level items for styling.
- foreach (element_children($content['menu']) as $link) {
- $content['menu'][$link]['#attributes']['class'][] = 'admin-menu-toolbar-category';
+ if (isset($content['menu'])) {
+ foreach (element_children($content['menu']) as $link) {
+ $content['menu'][$link]['#attributes']['class'][] = 'admin-menu-toolbar-category';
+ }
}
// Alter icon.
- unset($content['icon']['icon']['#theme']);
- $content['icon']['icon']['#title'] = '<span>' . t('Home') . '</span>';
- $content['icon']['icon']['#attributes']['class'][] = 'admin-menu-toolbar-category';
+ if (isset($content['icon'])) {
+ unset($content['icon']['icon']['#theme']);
+ $content['icon']['icon']['#title'] = '<span>' . t('Home') . '</span>';
+ $content['icon']['icon']['#attributes']['class'][] = 'admin-menu-toolbar-category';
+ }
// Alter user account link.
- $content['user']['account']['#title'] = t('Hello <strong>@username</strong>', array('@username' => $content['user']['account']['#title']));
- $content['user']['account']['#options']['html'] = TRUE;
+ if (isset($content['account'])) {
+ $content['account']['account']['#title'] = t('Hello <strong>@username</strong>', array('@username' => $content['account']['account']['#title']));
+ $content['account']['account']['#options']['html'] = TRUE;
+ }
}