From 5e1f407f36457ae2b608ce3a3cf51274b2e87a33 Mon Sep 17 00:00:00 2001 From: Chris Green <chrisgreen@arizona.edu> Date: Thu, 16 Jan 2025 17:22:00 -0700 Subject: [PATCH] Issue #3260219 Allow migrating special menu items. --- .../src/Plugin/migrate/process/LinkUri.php | 5 ++++- .../Kernel/Plugin/migrate/process/LinkUriTest.php | 12 ++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/core/modules/menu_link_content/src/Plugin/migrate/process/LinkUri.php b/core/modules/menu_link_content/src/Plugin/migrate/process/LinkUri.php index 04d189a713ed..82e2d985c3b6 100644 --- a/core/modules/menu_link_content/src/Plugin/migrate/process/LinkUri.php +++ b/core/modules/menu_link_content/src/Plugin/migrate/process/LinkUri.php @@ -93,9 +93,12 @@ public function transform($value, MigrateExecutableInterface $migrate_executable if ($path == '<front>') { $path = ''; } - elseif ($path == '<nolink>') { + elseif (empty($path) || in_array($path, ['<nolink>', '<none>'])) { return 'route:<nolink>'; } + elseif ($path == '<button>') { + return 'route:<button>'; + } $path = 'internal:/' . $path; // Convert entity URIs to the entity scheme, if the path matches a route diff --git a/core/modules/menu_link_content/tests/src/Kernel/Plugin/migrate/process/LinkUriTest.php b/core/modules/menu_link_content/tests/src/Kernel/Plugin/migrate/process/LinkUriTest.php index ed45cbe45711..0c68d3d310c3 100644 --- a/core/modules/menu_link_content/tests/src/Kernel/Plugin/migrate/process/LinkUriTest.php +++ b/core/modules/menu_link_content/tests/src/Kernel/Plugin/migrate/process/LinkUriTest.php @@ -73,10 +73,22 @@ public static function providerTestRouted() { $expected = 'internal:/'; $tests['front'] = [$value, $expected]; + $value = ''; + $expected = 'route:<nolink>'; + $tests['empty'] = [$value, $expected]; + + $value = '<none>'; + $expected = 'route:<nolink>'; + $tests['none'] = [$value, $expected]; + $value = '<nolink>'; $expected = 'route:<nolink>'; $tests['nolink'] = [$value, $expected]; + $value = '<button>'; + $expected = 'route:<button>'; + $tests['button'] = [$value, $expected]; + return $tests; } -- GitLab