Problem/Motivation
We have an ultimenu block that uses a menu named "Main Navigation Menu." The menu contains four top-level links:
- The first link points to an external arcgis URL. This item is *not* enabled as an Ultimenu region.
- The other three links point to internal URLs. These *are* all enabled as Ultimenu regions.
If I disable the first link in the menu, the page works normally. But if enabled, I get the following error:
The website encountered an unexpected error. Try again later.
UnexpectedValueException: https://modnr.maps.arcgis.com/apps/webappviewer/index.html?id=0cc1b6513d... has no corresponding route. in Drupal\Core\Url->getRouteName() (line 567 of core/lib/Drupal/Core/Url.php).
Drupal\ultimenu\UltimenuManager->linkElement() (Line: 389)
Drupal\ultimenu\UltimenuManager->buildMenuItem() (Line: 306)
Drupal\ultimenu\UltimenuManager->buildMenuTree() (Line: 214)
Drupal\ultimenu\UltimenuManager->preRenderBuild()
call_user_func_array() (Line: 113)
Drupal\Core\Render\Renderer->doTrustedCallback() (Line: 870)
Drupal\Core\Render\Renderer->doCallback() (Line: 432)
Drupal\Core\Render\Renderer->doRender() (Line: 248)
Drupal\Core\Render\Renderer->render() (Line: 475)
Drupal\Core\Template\TwigExtension->escapeFilter() (Line: 83)
__TwigTemplate_b80bb93062c0b98a35465e03ec9e3da8->block_content() (Line: 430)
Twig\Template->yieldBlock() (Line: 69)
__TwigTemplate_b80bb93062c0b98a35465e03ec9e3da8->doDisplay() (Line: 360)
Twig\Template->yield() (Line: 335)
Twig\Template->render() (Line: 38)
Twig\TemplateWrapper->render() (Line: 33)
twig_render_template() (Line: 348)
Drupal\Core\Theme\ThemeManager->render() (Line: 491)
Drupal\Core\Render\Renderer->doRender() (Line: 504)
Drupal\Core\Render\Renderer->doRender() (Line: 248)
Drupal\Core\Render\Renderer->render() (Line: 475)
Drupal\Core\Template\TwigExtension->escapeFilter() (Line: 46)
__TwigTemplate_3bb4475adc3276967c62c25cb18014f4->doDisplay() (Line: 360)
Twig\Template->yield() (Line: 335)
Twig\Template->render() (Line: 38)
Twig\TemplateWrapper->render() (Line: 33)
twig_render_template() (Line: 348)
Drupal\Core\Theme\ThemeManager->render() (Line: 491)
Drupal\Core\Render\Renderer->doRender() (Line: 248)
Drupal\Core\Render\Renderer->render() (Line: 475)
Drupal\Core\Template\TwigExtension->escapeFilter() (Line: 87)
__TwigTemplate_b6126a844cdca1bac555f34efd32fe80->doDisplay() (Line: 360)
Twig\Template->yield() (Line: 335)
Twig\Template->render() (Line: 38)
Twig\TemplateWrapper->render() (Line: 33)
twig_render_template() (Line: 348)
Drupal\Core\Theme\ThemeManager->render() (Line: 491)
Drupal\Core\Render\Renderer->doRender() (Line: 248)
Drupal\Core\Render\Renderer->render() (Line: 158)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 638)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 153)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse() (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray()
call_user_func() (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() (Line: 186)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 741)
Drupal\Core\DrupalKernel->handle() (Line: 19)
Setting any link to point to any external URL seems to trigger the error.
Steps to reproduce
Set up a menu. Set all links to point to internal URLs. Configure Ultimenu to use this menu and enable all the menu items as regions. Place the ultimenu block on the page. It should work as expected.
Edit the menu and change any of the links to point to an external URL. Save and clear cache, and try to reload a page where the Ultimenu block should display. You should see an error similar to the above.
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | ultimenu-externallinks-3467691.patch | 1.48 KB | adixon |
Comments
Comment #2
gausarts commentedGood catch. Never thought about external URLs.
Patches are welcome.
Thank you.
Comment #3
adixon commentedI found a couple of places where you're testing the url (for front or no-link) which can just be prefaced with a test whether it's external.
Patch attached.
Comment #4
gausarts commentedThank you.
Could anyone RTBC?
Comment #5
wrd-oaitsd commentedTested this yesterday afternoon, in fact, and it does seem to solve the problem! Code looks very straightforward to me.
Comment #6
wrd-oaitsd commentedComment #8
gausarts commentedThank you for contribution.