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.

Files: 
CommentFileSizeAuthor
#2 Move_Attributes_into_its_own_fieldset-1627806-2.patch786 bytesd.clarke
PASSED: [[SimpleTest]]: [MySQL] 108 pass(es).
[ View ]
#2 Move_Attributes_into_its_own_fieldset_with_menu_items_patch-1627806-2.patch6.93 KBd.clarke
PASSED: [[SimpleTest]]: [MySQL] 108 pass(es).
[ View ]

Comments

jberg1’s picture

Bump.
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

d.clarke’s picture

StatusFileSize
new6.93 KB
PASSED: [[SimpleTest]]: [MySQL] 108 pass(es).
[ View ]
new786 bytes
PASSED: [[SimpleTest]]: [MySQL] 108 pass(es).
[ View ]

Per 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.

<?php
function YOUR-MODULE-NAME_form_node_form_alter(&$form, $form_state) {
  if (isset(
$form['menu']['link']['options']['attributes']['#type'])) {
   
$form['menu']['link']['options']['attributes']['#type'] = 'fieldset';
   
$form['menu']['link']['options']['attributes']['#collapsed'] = TRUE;
  }
}
?>
joelpittet’s picture

Issue summary:View changes
Status:Active» Reviewed & tested by the community

Both patches work like a charm, thanks you for this small but huge UI improvement.

  • joelpittet committed 9d970a3 on master authored by d.clarke
    Issue #1627806 by d.clarke | clavigne: Added Move Attributes into its...
joelpittet’s picture

Status:Reviewed & tested by the community» Fixed

Thanks you at @d.clarke for the patch and @clavigne for posting the issue. This has been committed in 9d970a3

  • joelpittet committed 6742012 on 7.x-1.x authored by d.clarke
    Issue #1627806 by d.clarke | clavigne: Added Move Attributes into its...
joelpittet’s picture

Whoops wrong branch, real commit this time hash 6742012

Status:Fixed» Closed (fixed)

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

limehouse’s picture

Hi,

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

joelpittet’s picture

@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.

limehouse’s picture

Hi 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