Similar functionality as what is provided by admin_menu, where local tasks are able to be moved into the admin menu toolbar.

It would be really nice to be able to have tabs moved into the navbar.

I know this isn't the proper way to do it, and it would ideally want to be implemented as a behavior, but this snippet of jquery gets it working in at least a very rudimentary way for primary tabs in the content area (this would be the view/edit/etc tabs on a node page)

(function($) {
  var $tabs = $('#content').find('ul.tabs.primary');
    .append('<ul class="menu"></ul>')
Members fund testing for the Drupal project. Drupal Association Learn more


jessebeach’s picture

Hi willvincent, we're definitely interested in this functionality. It isn't on our roadmap at the moment, but we're happy to entertain patches. It would be best to have the actions added at the server level, rather than page scraping. You example does suggest the desired behavior well.

willvincent’s picture

If you can point me in the right direction I may be able to put together a proper patch that does this at the server level. Not quite sure where to start digging though.

jessebeach’s picture

sun's module Administration menu has this functionality.

jessebeach’s picture

The other option is to help him make that module responsive (last I checked a while ago it wasn't, but that might not be the case any more).

TomTech’s picture

Status: Active » Needs review
6.14 KB

Attached is a patch against dev as of 2013-10-29 that adds the primary and secondary tabs server side.

The removal of the existing primary and secondary tabs is currently done client side.

TomTech’s picture

Issue summary: View changes

Fixed formatting

MacMladen’s picture

I also pledge for a addition to move local tasks to menu, however, not in the way patch do it as I see it is not efficient.

There could be many tasks, for sure, modules may add them but the most common is Edit and it is the most used one.

I would suggest to move primary local tasks in line with Home Menu User | View Edit Track Other and eventually those having subtasks (secondary) may appear in sidebar list.

Usability is also about being more productive and less forced to click to reveal.

TomTech’s picture

Issue summary: View changes
7.18 KB

@MacMladen, thanks for reviewing this.

I was concerned with a boatload of tasks filling up the main navbar, which is why I didn't first class the tasks.

Here is another patch that DOES first class the tasks, and puts the secondary tasks in the first tray.

Also, since I had a little more time to understand the activeTab, it also properly switches tabs when you navigate, unlike the first patch.

Though it does bloat the primary navbar if your modules load up on tasks, it does save a few clicks and page loads.

jessebeach’s picture

TomTech, thanks for this patch! It's a great start.

I've committed the formatting issues you found. Thanks for those.

Some feedback. I'd love if you could keep hacking on this.

Put the local tasks into the Toolbar's main bar is not going to scale. Ideally we want them interleaved with the menu tree in the tray.

Having the actions available would be the most valuable. E.g. Add content or Add block.

I'm also getting PHP errors on a path like /admin/content.

I've attached the cleaned-up patch minus the formatting changes.

jessebeach’s picture

Status: Needs review » Needs work
TomTech’s picture


Thanks for giving it a go.

I'll give it another attempt.

Earlier in this thread, I did start it by just adding a "Task" Tab and attempting to place it in there.

I ran into 2 issues:

1) On the usability side, I concur with @MacMladen. When you need two clicks to get to Tasks/Edit or 3 to get to Tasks/Webform/Form Settings and a page load, it can be quite daunting to get there.

2) On the technical side, I was having an issue with the admin menu's

    being tied to an instance of MenuVisualView.

    I wasn't sure if the better approach would be:
    1) to create another instance of MenuVisualView for the Tasks menu(and for every additional menu??), and then something else to be a controller to manage them, or
    2) to have MenuVisualView point higher up the tree and encompass all multi-level submenus below it.


jessebeach’s picture

TomTech, I updated the jQuery.fn.drupalNavbarMenu plugin so it's now idempotent. You can run it a menu new nodes will be processed. Here's an example Drupal behavior that runs on all attachBehavior calls (such as after an AJAX insert command) that processes new nodes.

(function (Drupal, $) {

"use strict";

Drupal.behaviors.chameleonNavbarMenu = {
  attach: function (context) {
    if ('drupalNavbarMenu' in $.fn) {

}(Drupal, jQuery));

You just need to add the links and invoke Drupal.attachBehaviors(), no need to mess with the Views.