I think theme_site_map_box should have $variables['id'] as well it should make styling more easy.

CommentFileSizeAuthor
#4 site_map_drupal_attributes.patch10.75 KBfrjo
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

frjo’s picture

Is the "class" variable not sufficient?

jibran’s picture

In menu item case if I want to have different styling for primary and secondary menu. Then there is no way I can distinguish between both the menus because both have same class site-map-menu-box and no id.
I have overridden theme_site_map_box in my template.php and added id using menu title as id but menu title can be same as well. If menu name(or machine name of menu) is passed to theme_site_map_box as id or just as $variables['name'] it will make task a lot easier.

frjo’s picture

Assigned: Unassigned » frjo
Status: Active » Postponed

I see, that makes sense. Will take a look at it.

frjo’s picture

Version: 7.x-1.0-beta1 » 7.x-1.x-dev
Status: Postponed » Needs review
FileSize
10.75 KB

The attached patch modernises he handling of attributes like class for theme_site_map_box by using drupal_attributes() function.

I have added a "'site-map-box-menu-' . $mid" class that should be unique for every menu. A unique class should work as well for you as an id, doesn't it?

I have changed the class names from "site-map-menu-box" to "site-map-box-menu". The classes now look like this:

site-map-box site-map-box-menu site-map-box-menu-navigation

More logical and more like how Drupal core does it.

Please try it out and report back here.

Remember to clear the Drupal cache after applying the patch.

jibran’s picture

Yeah unique class is fine and using drupal_attributes() function is also cool. Patch is working very well.

frjo’s picture

Status: Needs review » Fixed

Committed to 7-dev, thanks for testing!

Status: Fixed » Closed (fixed)

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