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' => '
', '#suffix' => '
', );
Files: 
CommentFileSizeAuthor
#13 admin_menu-n1788822-13.patch722 bytesDamienMcKenna
PASSED: [[SimpleTest]]: [MySQL] 228 pass(es). View
#12 admin_menu-shortcuts_active-1788822-12.patch475 bytesemmonsaz
PASSED: [[SimpleTest]]: [MySQL] 228 pass(es). View
#10 admin_menu-shortcuts_active-1788822-10.patch2.11 KBjamsilver
PASSED: [[SimpleTest]]: [MySQL] 228 pass(es). View
#5 admin_menu-shortcuts_active-1788822-5.patch2.11 KBmalcomio
PASSED: [[SimpleTest]]: [MySQL] 228 pass(es). View
#2 admin_menu-toolbar-active-by-default-1788822-2.patch612 bytesPeacog
PASSED: [[SimpleTest]]: [MySQL] 228 pass(es). View

Comments

rtdean93’s picture

I agree. Where did you put this code?

Peacog’s picture

Status: Active » Needs review
FileSize
612 bytes
PASSED: [[SimpleTest]]: [MySQL] 228 pass(es). View

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
PASSED: [[SimpleTest]]: [MySQL] 228 pass(es). View

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
PASSED: [[SimpleTest]]: [MySQL] 228 pass(es). View

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

FileSize
475 bytes
PASSED: [[SimpleTest]]: [MySQL] 228 pass(es). View

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
PASSED: [[SimpleTest]]: [MySQL] 228 pass(es). View

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
scotself’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.