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.
Because the attributes fields are so numerous and take up a lot of vertical space, I was wondering if the attributes fields could be in their own fieldset inside the Menu settings area.
Ideally, this fieldset would be collapsed by default.
In all of my cases of using menu attributes, adding attributes is not the norm, hence having the fields available for all cases is confusing for some users who think they must all be filled out.
Comment | File | Size | Author |
---|---|---|---|
#2 | Move_Attributes_into_its_own_fieldset-1627806-2.patch | 786 bytes | d.clarke |
#2 | Move_Attributes_into_its_own_fieldset_with_menu_items_patch-1627806-2.patch | 6.93 KB | d.clarke |
Comments
Comment #1
jberg1 CreditAttribution: jberg1 commentedBump.
It would also be nice to either control where they appear on the node add/edit screen so they could be moved down the page, put in a collapsed field set, or even better to completely disable them for certain content types.
These extra field can be confusing for some users. And when I disable them from the settings then I don't have the opportunity to use them when editing the menu items under menu.
Any solution on hiding these fields in certain content types?
......
oops, I think I found my issue, why it still appears when all menus are disabled.
Menu attributes displayed even if all menus are disabled for a content type
Comment #2
d.clarke CreditAttribution: d.clarke commentedPer the original issue request, it turns out this a fieldset by default in the code, but then it is changed from a fieldset to a container. This logic to change it to a container was completed in commit:
76c69d71 - Moved the description element handling back into menu_attributes_form_menu_edit_item_alter() and improved display of attribute form elements.
Since the maintainers changed it from a fieldset to a container I'm not sure this will be committed, but attached are two patches: one that chages it back to a fieldset and makes it default to collapsed, and a second patch that does the same thing if you are using the patch from issue #1488960: Attributes for LI element.
Regardless, this isn't too bad to switch back to a fieldset and make it collapsed by default in your own module via a hook_form_alter. Just add the following code to a custom module and make sure your module's form alter runs after the menu_attributes' alter either by using the module name, module weight, or hook_module_implements_alter.
Comment #3
joelpittetBoth patches work like a charm, thanks you for this small but huge UI improvement.
Comment #5
joelpittetThanks you at @d.clarke for the patch and @clavigne for posting the issue. This has been committed in 9d970a3
Comment #7
joelpittetWhoops wrong branch, real commit this time hash 6742012
Comment #9
limehouse CreditAttribution: limehouse commentedHi,
Thanks for this improvement for a very useful module.
On both the node form and the menu settings page, I have found that the 'Menu item attributes' fieldset is now collapsed by default, the 'Menu link attributes' are still expanded by default.
Please can this also be changed, or have I missed something?
Thanks again
Comment #10
joelpittet@limehouse Would you mind opening up a new issue to look at addressing this? I don't think you missed anything.
It can be changed if there is good rational behind it;)
We don't normally re-open closed issues but you can relate the two as a follow-up to this.
Comment #11
limehouse CreditAttribution: limehouse commentedHi Joel,
Thanks, would be great if it could. The reasoning is the same as above I guess, my clients end up with a very long node form as this field is default expanded - and they are easily confused!
Thanks