Issues when also using link_attributes module

Created on 3 May 2023, almost 2 years ago
Updated 14 May 2024, 11 months ago

Problem/Motivation

When using both both link_attributes and also menu_link_attributes, both "attributes" fieldsets are displayed on the menu link item.

The is a use case where both are needed:
Link attributes (being used for link fields or in wysiwyg buttons on text area fields)
Menu Link Attributes being added to support the data-lang attribute needed for translations for example

When you edit a menu item you see a section for both the link_attributes and also for the menu_link_attributes inputs.

If you enter attributes into the link_attributes section, but not the menu_link_attributes, then the enter values get stripped when saving the menu item.

As expected however, if you enter the add the attributes and enter a value into the menu_link_attributes section, they get also get added to the link attributes as well (expected behaviour).

Steps to reproduce

Enable both link_attributes and also menu_link_attributes

Both contrib modules do similar things in that they add the attributes to the links on the website. Link attributes is needed to add to any link such as in a wysiwyg button on the text area field, but menu_link_attributes can support more attributes that are not fully supported and it adds them to menu links.

Proposed resolution

Fix the make submission so that the entries saved into the link_attributes section remain once saved.
Alternatively we could perhaps hide the link attributes fieldset when both modules are in use, that way the attributes will get added to both as expected.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇬🇧United Kingdom the_g_bomb

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

Comments & Activities

Production build 0.71.5 2024