There are a lot of issues that deal with problems regarding the admin module conflicting with the toolbar module in core. The truth is there is overlap in functionality, but they *do* serve two different purposes. This proposal takes the best of both worlds, by letting the admin menu adopt the style of the toolbar module, if it exists, and sits on top of the toolbar. Because the toolbar is programed to always sit at the top of the page, the patch also assumes that if you have toolbar module turned on, your admin menu will also sit at the top of the page.

I realize there are other solutions out there that let you choose the menu bar you want per role (admin_select) as well as the admin_menu_toolbar #1022902: Align Better Toolbar style with core Toolbar style which is a similar approach that appears to try to change the entire functionality of the admin menu to more closely approach and override the toolbar module.

I feel that this patch (a simple addition to the admin_menu.css) is a much cleaner approach, that lets the two menus live together, overlaying the admin_menu above the toolbar, while letting site admins use both, or either at the same time, for instance, to add shortcuts to the toolbar for their users with lower permissions, while also still using the unbelievably helpful sub-menus of the main admin menu bar. This patch can be thought of as simply adding the admin_menu dropdowns to core Toolbar module.

There is one basic assumption for this to work: older IE is not supported because it doesn't support css directive chaining. However, anyone seriously administering a website should really be using a modern browser anyway. I dont know that this is even still a point of departure for this module, but mention it for clarity. The (eg body.toolbar.admin_menu) that this patch depends on to neutralize the margin-top:20 !important set by admin_menu.css is unfortunately a necessity at this time.

CommentFileSizeAuthor
admin_menu-toolbar-integration.patch1.49 KBjwilson3
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Status: Needs review » Needs work

The last submitted patch, admin_menu-toolbar-integration.patch, failed testing.

jwilson3’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, admin_menu-toolbar-integration.patch, failed testing.

RunePhilosof’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, admin_menu-toolbar-integration.patch, failed testing.

RunePhilosof’s picture

Why on earth would this fail?
The tests fail because of trying to allocate too much memory.
But this patch shouldn't change anything about how much memory is being allocated.

docans’s picture

i have found a way to make both admin and toolbar menu with shortcuts coexit and avoid the duplicate bar

Step 1: enable both toolbar and admin menu
Step 2: download and install the css_injector module
Step 3: go to your_site/admin/config/development/css-injector and create a new rule
Step 4: give it a title of your choice and in the css code section give it this code

#toolbar div.toolbar-menu {
margin-top: -32px;
}

Step 5: save , clear cache and run cron

Hope this will be helpful

FiNeX’s picture

I suggest to disable the toolbar if the user have the permession to use admin menu.

This is an example:

/**
 * Implements hook_page_alter().
 */
function YOURMDULENAME_page_alter(&$page) {
  if (user_access('access administration menu') && !empty($page['page_top']['toolbar'])) {
    $page['page_top']['toolbar']['#access'] = FALSE;
  }
}
sheldonkemper’s picture

@ FiNeX

Your solution works for me, thanks.

I originally resorted to having both toolbar and admin menu enabled in modules, then assigning users permission to use toolbar, but because user\1 has the issue of multiple toolbars I created a second admin account. This worked. but had its own issues.

Dr.Osd’s picture

#8 Thanks for FiNeX. Very useful.

Dave Reid’s picture

Status: Needs work » Closed (won't fix)

I would recommend using the https://www.drupal.org/project/admin_select module.