Missing fields when used with module "Menu Item Extras"

Created on 18 September 2024, about 2 months ago

Problem/Motivation

When both this module and Menu Item Extras module β†’ are enabled, the Translated Link field is missing.

Steps to reproduce

- Install Drupal 10.3 (same effect on previous versions)
- Install multilingual_menu_urls version 10.0.1
- Install menu_item_extras version 3.1.0
- Add at least one language.
- Enable translation for a menu.
- Translate a menu link.
- Notice that Translated Link is missing.

Proposed resolution

Change the form-alter hook, from hook_form_FORM_ID_alter to hook_form_BASE_FORM_ID_alter. See next paragraph for details.

This module's field is missing because the module assumes that the form ID of the menu link form is menu_link_content_menu_link_content_form. This form ID is composed from the menu link's entity type ID and its bundle ID, both of which are "menu_link_content". However, menu_item_extras module seems to provide a different bundle ID to each menu, based on the menu's machine name. This results in a form ID like menu_link_content_[bundle]_form.

Targeting the base form ID, which is always menu_link_content_form, fixes this issue, both with and without menu_item_extras.

Remaining tasks

Testing.

πŸ› Bug report
Status

Needs review

Version

10.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States krisahil

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024