- πΊπΈUnited States darren oh Lakeland, Florida
This issue is about the field_menu module, not the menu_field module. There is no supported Drupal 7 version of the field_menu module.
Looks like menu_field has been refactored quite from the version that we are using and does not include the "remove item" any more.So this may not apply to current branch of the code.
The remove item button only seems to work the second time it is clicked. The first time it is clicked it does not do anything.
First line is first instance of menu field
Second line is second instance of menu field
Note: the name and id is the same for both Remove item buttons
<input ... id="edit-field-menu-und-0-remove-button" name="menu-field-remove-4ddb5f3e-12ed-11e2-bbcc-000c29cc69ea" ...>
<input ... id="edit-field-mobile-menu-und-0-remove-button" name="menu-field-remove-4ddb5f3e-12ed-11e2-bbcc-000c29cc69ea" ...>
Once, the Remove item has been clicked for a field the first time, when you click it the second time the correct action of removing the item is performed.
Note: The name is the same, but the id is different for each item
<input ... id="edit-field-menu-und-0-remove-button" name="menu-field-remove-4ddb5f3e-12ed-11e2-bbcc-000c29cc69ea" ...>
<input ... id="edit-field-menu-und-0-remove-button--2" name="menu-field-remove-4ddb5f3e-12ed-11e2-bbcc-000c29cc69ea" ...>
You can see that names for both Content and Mobile fields are exactly the same which is a problem because when Remove item is first clicked it does not know which field to act on. However, once the AJAX call happens the first time the id for the field being clicked on is rewritten appending --2 to the id to signify a distinction between the two buttons (content & mobile). Then clicking on Remove item for the second time works.
The issue appears to be the fact that the fields have the same field name for the Remove item button. To fix this, we can add the $id_prefix
(defined on line 163) to the end of the name for the Remove item option:
/sites/all/modules/contrib/field_menu.module
264 '#name' => 'menu-field-remove-' . $item['uuid'], // Before
264 '#name' => 'menu-field-remove-' . $item['uuid'] . '-' . $id_prefix, // After
Now the "Remove item" works correctly on the first click because it can uniquely identify the field that was clicked.
With the corrected code the field names for the Remove item button now have unique field names with the field name appended to the original name for the Remove item button.
... id="edit-field-menu-und-0-remove-button" name="menu-field-remove-4ddb5f3e-12ed-11e2-bbcc-000c29cc69ea-field_menu" ...
... id="edit-field-mobile-menu-und-0-remove-button" name="menu-field-remove-4ddb5f3e-12ed-11e2-bbcc-000c29cc69ea-field_mobile_menu" ...
Closed: won't fix
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
This issue is about the field_menu module, not the menu_field module. There is no supported Drupal 7 version of the field_menu module.