Attributes with underscores are dropped by update 8004 instead of being migrated to hyphens

Problem/motivation

Follow-up to #3590635 (closed). Update 8004 (8.x-1.8 and 8.x-1.9) removes every attribute definition whose name does not match ^[a-zA-Z][-a-zA-Z0-9]*$. That includes attributes with underscores, like menu_color, which are harmless and only need a hyphen instead. Their whole definition (label, description, options, container flag) is dropped from menu_link_attributes.config, and the values stored on menu links are no longer editable or rendered. Saving a link through the UI then wipes the value for good.

The restore post update from #3590635 (closed) skips these names, because they are not allowed as they are.

Steps to reproduce

  1. On 8.x-1.7, add an attribute menu_color with options and container: true, and set it on a menu link.
  2. Update to 8.x-1.8 or 8.x-1.9 and run drush updb.
  3. menu_color is gone from menu_link_attributes.config; the menu link still has container_attributes.menu_color stored, but it is no longer rendered.

Proposed resolution

Migrate instead of dropping: replace underscores with hyphens (menu_color → menu-color).

  • Update 8004 renames such definitions instead of removing them, so sites not yet updated keep label, description and options.
  • A new post update renames the keys stored on every menu link (all translations) and re-adds a definition to the config for each renamed attribute that is still missing there (sites where 8004 already ran).

Front-end code (CSS/JS/Twig) that targets the old attribute name still needs a manual adjustment. Definitions already removed by 8004 come back without label and options.

Remaining tasks

  • Review
  • Release note