From 32785c48bb3ef5dd927f873f107bd799baa7a856 Mon Sep 17 00:00:00 2001 From: tuutti Date: Fri, 13 Jan 2023 10:02:18 +0200 Subject: [PATCH 1/2] UHF-7938: Return null derivative id to skip translatable_menu_link_uri_iterate_menu() --- src/Plugin/Menu/ExternalMenuLink.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Plugin/Menu/ExternalMenuLink.php b/src/Plugin/Menu/ExternalMenuLink.php index 59e76dd..ec07ce3 100644 --- a/src/Plugin/Menu/ExternalMenuLink.php +++ b/src/Plugin/Menu/ExternalMenuLink.php @@ -11,6 +11,15 @@ */ final class ExternalMenuLink extends MenuLinkBase { + /** + * {@inheritdoc} + */ + public function getDerivativeId() : ? string { + // Return NULL explicitly, so we don't unnecessarily process global + // navigation links in 'translatable_menu_link_uri_iterate_menu()'. + return NULL; + } + /** * {@inheritdoc} */ From f3e07106566a435cad180c56a2d3613072740be8 Mon Sep 17 00:00:00 2001 From: tuutti Date: Fri, 13 Jan 2023 10:05:19 +0200 Subject: [PATCH 2/2] UHF-7938: Better comment --- src/Plugin/Menu/ExternalMenuLink.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Plugin/Menu/ExternalMenuLink.php b/src/Plugin/Menu/ExternalMenuLink.php index ec07ce3..76eeb20 100644 --- a/src/Plugin/Menu/ExternalMenuLink.php +++ b/src/Plugin/Menu/ExternalMenuLink.php @@ -15,8 +15,9 @@ final class ExternalMenuLink extends MenuLinkBase { * {@inheritdoc} */ public function getDerivativeId() : ? string { - // Return NULL explicitly, so we don't unnecessarily process global - // navigation links in 'translatable_menu_link_uri_iterate_menu()'. + // External menu links share the plugin id with regular 'menu_link_content' + // links. Explicitly return NULL to skip the processing done in + // 'translatable_menu_link_uri_iterate_menu()' function. return NULL; }