Install

Works with Drupal: ^8 || ^9 || ^10 || ^11

Using Composer to manage Drupal site dependencies

Alternative installation files

Download tar.gz 22.63 KB
MD5: a42c76a6a245c9c2a445db608e6bdac4
SHA-1: 6113c0f09731f6efe90f1d6bb72873a12fbc649a
SHA-256: d7645552a5892a33aae309651892611af4c6b8159ea2685a8635a48cb12bf686
Download zip 31.04 KB
MD5: 69564c8f9e60748b4e432e1877066ecd
SHA-1: 84cacbda3a6a3998aad5abd4ea2af99b9c310ced
SHA-256: 4fb26e8c5efdbfebb9fe4dcec3e436af1721fcb487cb75f7d6f340e29b4a34cb

Release notes

Menu Link Attributes 8.x-1.10

How we got here

  • 8.x-1.8 was a security release. Update 8004 removes attribute definitions whose names are not valid HTML attribute names, so they can no longer be rendered unsafely. It also removed two kinds of attributes it should have kept:
    • Container attributes such as container_class.
    • Attributes whose names were only invalid because of underscores, such as menu_color.
  • 8.x-1.9 restores the container attributes removed by 8.x-1.8 (#3590635).
  • 8.x-1.10 handles attribute names with underscores. Instead of removing them, it renames them to use hyphens, for example menu_color → menu-color (#3590636).

What happens when you update

After running drush updb, export your configuration (drush cex) and check the attributes in your menu_link_attributes.config. If you spot any updated attribute names, front-end changes might be needed (see below).

Coming from 8.x-1.7 or earlier:

  • Update 8004 renames attribute definitions with underscores in place, keeping their labels, options and order.
  • A post update renames the values stored on menu links, including translations.

Coming from 8.x-1.8 or 8.x-1.9, where 8004 already ran:

  • A post update renames the values stored on menu links, including translations.
  • It also re-adds the definitions that were removed. Their labels, descriptions and options were lost in 8.x-1.8 and had to be re-entered on the configuration form.
  • Empty duplicate container_* definitions created by 8.x-1.9 were removed.

The update output lists every renamed attribute. A warning is also logged to watchdog for sites that do not read update output.

⚠️ Front-end changes may be needed

If you in the past used Menu Link Attributes to set custom attributes with names with underscores, the rendered HTML now changes automatically:

<!-- Before -->
<a href="/about" menu_color="red">About</a>
<!-- After -->
<a href="/about" menu-color="red">About</a>

Any front-end code targeting the old names stops working. This includes CSS selectors ([menu_color]), JavaScript (getAttribute('menu_color'), dataset) and Twig templates. If these attributes are used for anything important, such as styling, tracking or behaviour, update those references manually.

The config form no longer accepts underscores in attribute names. It suggests the hyphenated name instead.

Name collisions

If both versions of a name exist, for example menu_color and menu-color, only the hyphenated one is kept:

  • In configuration: the definition with the underscore is removed, and the update output lists it under "Removed unsafe menu link attributes".
  • On menu links: if a link has values under both names, the value stored under the hyphenated name is kept and the one with the underscore is dropped.
Created by: norman.lol
Created on: 8 Oct 2026 at 14:10 UTC
Last updated: 9 Oct 2026 at 07:26 UTC
Bug fixes

Other releases