Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I think theme_site_map_box should have $variables['id'] as well it should make styling more easy.
Comment | File | Size | Author |
---|---|---|---|
#4 | site_map_drupal_attributes.patch | 10.75 KB | frjo |
Comments
Comment #1
frjo CreditAttribution: frjo commentedIs the "class" variable not sufficient?
Comment #2
jibranIn 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.
Comment #3
frjo CreditAttribution: frjo commentedI see, that makes sense. Will take a look at it.
Comment #4
frjo CreditAttribution: frjo commentedThe 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:
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.
Comment #5
jibranYeah unique class is fine and using drupal_attributes() function is also cool. Patch is working very well.
Comment #6
frjo CreditAttribution: frjo commentedCommitted to 7-dev, thanks for testing!