If you edit a menu item's attributes at
admin/structure/menu/item/[mlid]/edit
and save the form, the altered values are not saved to the database. The form at
node/[nid]/edit
works fine.

CommentFileSizeAuthor
#1 1200928_menu_attributes_save.diff547 bytesdalin
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dalin’s picture

Status: Active » Needs review
FileSize
547 bytes

I was curious about the bug so I decided to investigate. A tricky nut to crack, but obvious once I saw the offending line. The problem is the following code in menu_edit_item in modules/menu/menu.admin.inc (line 271):

foreach (array('link_path', 'mlid', 'module', 'has_children', 'options') as  $key) {
  $form[$key] = array('#type' => 'value', '#value' => $item[$key]);
}

Solved by adding one line of code to the form alter:

unset($form['options']['#value']['attributes']);
amateescu’s picture

Status: Needs review » Reviewed & tested by the community

Confirmed the bug and tested the patch. Works as advertised :)

Just to clarify, this happens when you edit an already set attribute.

Dave Reid’s picture

Status: Fixed » Closed (fixed)

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