Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
The Menu Item Attributes fieldset is open by default, even when empty.
Is there a way to cause it to be closed when empty?
Comments
Comment #1
escoles CreditAttribution: escoles commented(correcting version)
Comment #2
escoles CreditAttribution: escoles commentedComment #3
escoles CreditAttribution: escoles commentedHave been attempting to modify the collapsed status via hook_node_alter. Not sure how to reference the menu_attributes fieldset. I do know that this does NOT work:
However, I've verified that the code should work against a top-level fieldset -- this DOES work to collapse the Menu settings fieldset:
(This also confirms that the module weight is sufficiently high to execute after menu_attributes.)
Comment #4
escoles CreditAttribution: escoles commentedThe proper way to address the Menu Attributes fieldset is this:
$form['menu']['options']['attributes']
So, you can collapse that fieldset by default by creating a custom module, as described here:
http://www.initsix.co.uk/collapse-or-expand-drupal-6-fieldsets-default
... and here:
http://drupal.org/node/708438
This is the code I used:
Still would make a lot more sense to me for this module to be collapsed when no attributes have been set. It takes up easily 2/3 of the vertical space in the browser window of the 1024px-high screen I'm using right now.
Comment #5
escoles CreditAttribution: escoles commentedComment #6
TimeBandit CreditAttribution: TimeBandit commentedThis works in menu section (admin/build/menu) but I can't seem to affect node/add pages...
ehhh... my coding powers near zero, I chickened out and just used JQuery:
$("legend:contains('Menu item attributes')").parent().addClass('collapsed');
Comment #7
jimmynash CreditAttribution: jimmynash commentedI think this approach works using the default in the switch. I had to make my custom module a little heavier than the menu_attributes module. It had a weight of 10, I made my module weight 11 and was able to get this to work across the site.
Comment #8
ParisLiakos CreditAttribution: ParisLiakos commentedFor drupal 7 do this:
and dont mess with module weights...much simpler
Comment #10
mikelaroy CreditAttribution: mikelaroy commentedI created a module based on the last post, but haven't got around to packaging it up properly.
You can find the module here.