Problem/Motivation
The link_uri migrate process plugin provided by the core menu_link_content module provides handling for links referencing the special <front> and <nolink> routes but does not currently support the special <button> route added in 8.8 (https://www.drupal.org/node/3053689).
When migrating into menu links url field I receive the following error.
-------------- ------------------- ------- ---------------------------------------------------------------
Source ID(s) Destination ID(s) Level Message
-------------- ------------------- ------- ---------------------------------------------------------------
1 1 The path "internal:/<button>" failed validation.
Steps to reproduce
in my migration_name.yml file I am using the menu_link_content process
process:
bundle: menu_link_content
title: title
menu_name: menu
# Handle external urls or url aliases.
'link/uri':
plugin: link_uri
source: urlpath
In my source migration_name.json file
{
"menu_links": [
{
"link_id": "1",
"parent_link_id": "0",
"menu": "az-resource-menu",
"title": "Resources",
"urlpath": "<button>",
"external": false,
"expanded": true,
"enabled": true,
"weight": "1"
},
Proposed resolution
Add the supported special route to https://git.drupalcode.org/project/drupal/-/blob/9.4.x/core/modules/menu...
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Add the ability to migrate the following menu item types <button>, <none>,''.
| Comment | File | Size | Author |
|---|---|---|---|
| #27 | Screenshot 2025-02-20 at 12.08.43 PM.png | 86.84 KB | smustgrave |
Issue fork drupal-3260219
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
joegraduateComment #4
trackleft2Comment #5
trackleft2Comment #6
trackleft2Comment #8
joegraduateComment #9
trackleft2Additionally, this article https://www.drupal.org/project/drupal/issues/2999549 classifies this as an accessibility issue
Here is a patch https://git.drupalcode.org/project/drupal/-/commit/433ff509236a848c39cb9...
Comment #11
joegraduateMR looks good to me. I think this needs an issue summary update so that it accounts for the changes involving
<none>as well, though.Comment #12
trackleft2Comment #13
trackleft2Comment #14
joegraduateComment #15
mikelutzAt first glance, This seemed fine to me, but after more thought, I do have a question and concern. The question is: What are you using as a source that is generating as the url? Is this a JSONAPI or JSON export from another Drupal site?
The main concern is that those process plugins, especially field_link are made specifically for migrating D7 links into D8, and D7 did not support so there's no need for the processor to support it. Any other source that might be generating something that should be turned into `route:` is kind of a custom thing. Like why do we support and not allow route: to pass through.
My gut says we probably don't need to add this to field_link, as this is D7 link field specific, but we should allow *something* passed into linkuri to end up as route: but I'm still a bit up in the air as to what. If we do leave this or something similar in linkuri, then the documentation also needs to be updated.
Comment #19
trackleft2This functionality came from https://www.drupal.org/project/special_menu_items which has been discontinued as of Drupal 8 because the functionality was added to core so there is nowhere to put this as far as I can tell.
Comment #24
trackleft2Updated the fork with 11.x, and set a new merge target (11.x)
Comment #25
trackleft2Comment #26
trackleft2I've removed the functionality from the field_link plugin as special_menu_items does not apply to link field AFAICT.
Comment #27
smustgrave commentedSome reason the test-only is failing but not showing any output, so ran locally
Which shows the coverage.
Summary appears to be complete and no open threads
LGTM.
Comment #29
catchThis looks good and core migrations are the right place to add support for discontinued Drupal 7 modules that are handled by Drupal 8+ core features.
Committed/pushed to 11.x and cherry-picked to 10.5.x, thanks!