In D7, the system module is in charge of the following menu blocks: Navigation, Management, User menu, Main menu, Secondary menu

This means that in order to apply the same styling to all menu blocks, you need to use the following CSS selector:

.block-menu,
#block-system-navigation,
#block-system-management,
#block-system-user-menu,
#block-system-main-menu,
#block-system-secondary-menu {
  // styling
}

This is just awful, awful experience for themers and non-obvious. Fortunately, its easy to add the "block-menu" class back to those 5 special case system-provided menu blocks.

function FOO_preprocess_block(&$variables) {
   // System menu blocks should get the same class as menu module blocks.
  if ($variables['block']->module == 'system' && in_array($variables['block']->delta, array_keys(menu_list_system_menus()))) {
    $variables['classes_array'][] = 'block-menu';
  }
}

[above code edited after comment #4 was made.]

We should definitely do that to make things easier for themers and to make our stylesheets lighter weight (re: performance).

Comments

johnalbin’s picture

Status: Active » Fixed
StatusFileSize
new2.73 KB

I've made this change to Bartik's template.php and simplified its style.css.

johnalbin’s picture

Project: Bartik » Drupal core
Version: 7.x-1.x-dev » 7.x-dev
Component: Code » system.module
Status: Fixed » Needs review
StatusFileSize
new644 bytes

Of course, this really should be fixed in core.

johnalbin’s picture

StatusFileSize
new2.32 KB

Now that Bartik is in core, here's an updated patch to remove the duplicate code that is already in Bartik.

johnalbin’s picture

StatusFileSize
new2.37 KB

Ooops. Forgot we should be checking for $variables['block']->module == 'system' too.

moshe weitzman’s picture

Status: Needs review » Reviewed & tested by the community

No brainer

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Makes sense. Technically this is a markup change, but it seems to basically just be adding additional classes, and removing specialized code from Bartik to help ease the maintenance burden there. Let's not get too crazy with this trend, though. We need to get D7 out the door.

Committed to HEAD.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.