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
- On 8.x-1.7, add an attribute
menu_colorwith options andcontainer: true, and set it on a menu link. - Update to 8.x-1.8 or 8.x-1.9 and run
drush updb. menu_coloris gone frommenu_link_attributes.config; the menu link still hascontainer_attributes.menu_colorstored, 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