This is default behavior of Drupal core toolbar and I think it's a serious issue that shortcuts are hidden by default.
I'm an experienced Drupal user (but not so much with shortcuts because I've always used admin_menu) and I couldn't find the shortcut bar. I can imagine people who are new to Drupal and don't know that shortcuts exist will never find the shortcuts bar because they wouldn't know where to look and what to look for.

I'm going to use shortcuts in a distribution that has admin_menu enabled by default so it's a serious issue if there is no way to have shortcuts display out of the box.

Fix, add active class by default:

  // Add shortcuts bar.
  $content['shortcut'] = array(
    '#access' => module_exists('shortcut'),
    '#weight' => 200,
    '#prefix' => '<div class="shortcut-toolbar active">',
    '#suffix' => '</div>',
  );
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rtdean93’s picture

I agree. Where did you put this code?

Peacog’s picture

Status: Active » Needs review
FileSize
612 bytes

Thanks for the fix. I've rolled a patch for it.

jhubley’s picture

Status: Needs review » Reviewed & tested by the community

Just added this patch to a client site. Really helpful, thanks!

wildflower_0002’s picture

I was also able to apply this patch with success

malcomio’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Needs review
FileSize
2.11 KB

This would be a nice addition, although I'd prefer to make it configurable - here's a patch that does that.

gavin.hughes’s picture

Test patch #2 and it works perfectly

rickupdegrove’s picture

This is a great addition. Patch #5 works great and I like the added configuration option.

dtamajon’s picture

#5 is working properly, but just a little CSS adjustment on admin_menu_toolbar.css

#admin-menu .shortcut-toolbar {
  background-color: #666;
  clear: both;
  display: none;
  margin: 0 -10px;
  overflow: hidden;
  /* Align with icon; @see shortcut.css */
  padding-left: 5px;
}

Should be:

#admin-menu .shortcut-toolbar {
  background-color: #666;
  clear: both;
  display: none;
  margin: 0 0px; /* CHANGE IS HERE! */
  overflow: hidden;
  /* Align with icon; @see shortcut.css */
  padding-left: 5px;
}
malcomio’s picture

I'd say that the CSS change should be a separate issue - the misalignment exists with or without this patch.

I've created #2370505: Shortcuts misaligned for this issue.

jamsilver’s picture

Version: 7.x-3.x-dev » 7.x-3.0-rc5
FileSize
2.11 KB

Rerolled patch #5 for latest version of admin_menu (7.x-3.0-rc5).

emmonsaz’s picture

After applying the #10 patch, setting $conf['admin_menu_shortcuts_active'] = 1; in settings.php enables the Expand shortcuts by default checkbox by default but not the Shortcuts checkbox. Is there a way to enforce (via settings.php) the shortcuts to display?

Update: I solved it with this

$conf['admin_menu_components'] = array(
    'admin_menu.icon' => TRUE,
    'admin_menu.menu' => TRUE,
    'admin_menu.search' => TRUE,
    'admin_menu.users' => TRUE,
    'admin_menu.account' => TRUE,
    'shortcut.links' => TRUE,
);
emmonsaz’s picture

I still had issues with the shortcuts displaying after clearing my browser cache so I ended up doing this:

1. Apply the attached patch (it's hacky, I know...)
2. Add this to settings.php

$conf['admin_menu_components'] = array(
    'admin_menu.icon' => TRUE,
    'admin_menu.menu' => TRUE,
    'admin_menu.search' => TRUE,
    'admin_menu.users' => TRUE,
    'admin_menu.account' => TRUE,
    'shortcut.links' => TRUE,
);
DamienMcKenna’s picture

FileSize
722 bytes

Alternatively, how about this - enable the Shortcut option during hook_enable().

DamienMcKenna’s picture

Version: 7.x-3.0-rc5 » 7.x-3.x-dev
scotwith1t’s picture

These all have (small) issues:
The approach from @emmonsaz in #12 simply makes sure the shortcut component is enabled in admin_menu and then clicks it. This is fine if you want to assume that everyone will want to have the shortcuts open by default and make that not be configurable.

The patch in #10 has the opposite problem, in that the checkbox works fine, but doesn't trigger the extra 'admin-menu-with-shortcuts' class you get by clicking on the expander arrow, so the expanded shortcuts are just sitting on top of the content until you click it closed and then open again to get that needed class.

@DamienMcKenna's idea assumes everyone will want the shortcuts enabled by default and I don't think that really works either...

I'm hoping to keep using the solution in #10, but it just needs to making sure the js is triggered to add the extra class, that's really the only thing missing IMHO.

truls1502’s picture

Status: Needs review » Postponed (maintainer needs more info)
Issue tags: +postponed2w

I am sorry for no reply until now.

There are many issues regarding this module admin_menu which is a bit difficult for us to follow up since some of the issues might be already outdated, or is already fixed by the module or any other modules or itself core which means that the problem might no longer need to be fixed.

We can see that the issue has been created for a few years ago, I hope it is okay for you that I am postponing the issue, and give you around two weeks. If you still face the problem, could you tell us the step by step when until you get the error message or what is frustrated you, and a list of modules you are using related to admin_menu and a screenshot that might help us? So it makes us easier to reproduce your issue.

However, after two weeks with no feedback - we will close this issue. So in case, you noticed it after the issue is closed, do not hesitate to reopen it like and fill information which is mentioned above.

So before giving us a feedback, do you mind to test it again with our latest 7.x-3.x-dev?

Thank you for understanding! :)

truls1502’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)
Issue tags: -postponed2w

This issue has been automatically marked as closed because it has not had recent activity after the last post.

However, if you or someone is still facing the same issue as described to the issue, could you please to re-open the issue by changing the status of the issue, and add an explanation with more details which can help us to reproduce your situation.

Again, thank you for your contributions! :)