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>,''.

Issue fork drupal-3260219

Command icon 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

trackleft2 created an issue. See original summary.

joegraduate’s picture

Issue summary: View changes
trackleft2’s picture

Version: 9.3.x-dev » 9.4.x-dev
trackleft2’s picture

Issue summary: View changes
trackleft2’s picture

Issue summary: View changes

joegraduate’s picture

Issue summary: View changes
Status: Active » Needs review
Related issues: +#2999549: Allow button tag in LinkGenerator for better accessibility
trackleft2’s picture

Additionally, 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...

joegraduate’s picture

MR looks good to me. I think this needs an issue summary update so that it accounts for the changes involving <none> as well, though.

trackleft2’s picture

Title: Allow migrating <button> url special menu items since this is supported in core. » Allow migrating <none> <button> url special menu items and empty string, since this is supported in core.
trackleft2’s picture

Title: Allow migrating <none> <button> url special menu items and empty string, since this is supported in core. » Allow migrating <none> <button> url special menu items and empty string.
Issue summary: View changes
joegraduate’s picture

mikelutz’s picture

Status: Needs review » Needs work

At 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.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

trackleft2’s picture

This 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.

trackleft2 changed the visibility of the branch 3260219-allow-migrating-button to hidden.

trackleft2 changed the visibility of the branch 11.x to hidden.

trackleft2 changed the visibility of the branch issue/drupal-3260219 to hidden.

trackleft2’s picture

Updated the fork with 11.x, and set a new merge target (11.x)

trackleft2’s picture

Status: Needs work » Needs review
trackleft2’s picture

I've removed the functionality from the field_link plugin as special_menu_items does not apply to link field AFAICT.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Needs Review Queue Initiative
StatusFileSize
new86.84 KB

Some reason the test-only is failing but not showing any output, so ran locally

test

Which shows the coverage.

Summary appears to be complete and no open threads

LGTM.

  • catch committed a44b8858 on 11.x
    Issue #3260219 by trackleft2, smustgrave, joegraduate, mikelutz: Allow...
catch’s picture

Version: 11.x-dev » 10.5.x-dev
Status: Reviewed & tested by the community » Fixed

This 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!

  • catch committed 88344bd0 on 10.5.x
    Issue #3260219 by trackleft2, smustgrave, joegraduate, mikelutz: Allow...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.