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.
Function theme_menu_tree() provide standard ul that we can not give custom attributes.
Comment | File | Size | Author |
---|---|---|---|
#12 | menu_attributes_ul_attributes_2298033_12.patch | 6.1 KB | ijortengab |
#7 | menu_attributes.module.txt | 13.4 KB | ijortengab |
#5 | menu_attributes.module.txt | 13.58 KB | ijortengab |
#2 | ulattributes.patch | 12.14 KB | ijortengab |
Comments
Comment #1
joelpittetComment #2
ijortengab CreditAttribution: ijortengab commentedHow that patch working...
theme_menu_tree doesn't have any information like menu machine name, plid (parent link id), etc ... it's confusing.
Therefore, we ride information about menu with SESSION and title.
Comment #3
ijortengab CreditAttribution: ijortengab commentedHow to use..
set ul attributes in first link per depth
example: we have custom menu
Comment #4
joelpittetComment #5
ijortengab CreditAttribution: ijortengab commentedalternative patch.
Comment #6
ijortengab CreditAttribution: ijortengab commentedWe need to save information about menu to passing in theme_menu_tree().
I suggested that we ride menu information on the #title in first item menu.
example:
before:
#title = 'Home';
after
#title = '[menu_attributes]6[/menu_attributes]Home';
and if you do not agree about passing variable to SESSION, we can still ride through #title
example:
#title = '[menu_attributes]6-' . serialize($array_attributes). '[/menu_attributes]Home';
how about my idea?
Comment #7
ijortengab CreditAttribution: ijortengab commentedAlternative without passing to session
Comment #8
ijortengab CreditAttribution: ijortengab commentedi forget about default 'menu' class...
before return in function menu_attributes_menu_tree(), this code will be added:
Comment #9
joelpittetCan you do a regular patch file against the 7.x-1.x so we can review the changes against the 7.x dev code?
Detailed instructions are here: https://www.drupal.org/node/707484
My git patch workflow that may be easier to digest if you already know git to some extent is here: http://pittet.ca/drupal/sprint/patch
We aren't doing this token thing in the module yet:
[menu_attributes]6[/menu_attributes]
and it looks a bit suspect, TBH. I'd really rather not include this if we have to do session hacking because that will likely effect varnish or other caching mechanisms and #title feels like too much of a hack as mentioned in #6... It's a bit of an imperfect world the way theme_menu works but there are plenty of solutions in the issue queue for Drupal 8 improvements here. We've made it this far without this feature and honestly if it's that tricky to get this feature in, it may not be worth the hassle it could incur.Thanks for the effort thus far @ijortengab and tenacity on this feature request.
Comment #10
ijortengab CreditAttribution: ijortengab commented:thumbs_up:
yes.. this issue just to share my idea how to hack menu_attributes to have features with ul attributes. a lazy code but.. it's work. :-)
Comment #11
ijortengab CreditAttribution: ijortengab commentedmiss..
Comment #12
ijortengab CreditAttribution: ijortengab commentedfyi:
this link explain why my patch error..
http://stackoverflow.com/questions/13675782/git-shell-in-windows-patchs-...
i upload new patch and it should be fine... just for reference.
Comment #13
joelpittetOh wow that is good to know about the patch error, I don't use windows but when I must knowing these little gotchas are invaluable. thanks @ijortengab!
Dreditor is making that patch look much better to read:) http://dreditor.org/