Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
On fresh install and activation of the AMP Base theme, an error is thrown, that the "amp-skip-link.html.twig" couldn't be found.
Steps to reproduce:
- Install AMP and AMPtheme
- use "AMP Base" as AMP theme
- Activate AMP for a Content Type
- Create a new content of this type and go to its amp page by adding "?amp" to the URL
Comment | File | Size | Author |
---|---|---|---|
#14 | amp_skip_link-2848068-14.patch | 391 bytes | Shawn Conn |
#3 | amp_skip_link_-2848068-3.patch | 391 bytes | tjwelde |
Comments
Comment #2
tjwelde CreditAttribution: tjwelde at Thunder commentedComment #3
tjwelde CreditAttribution: tjwelde at Thunder commentedDrupal apparently only searches through theme templates for overrides. Since "amp_skip_link" is defined within the theme itself, it only looks in the root of templates. This patch adds the correct path to the render array definition.
Comment #4
Jaypan CreditAttribution: Jaypan at Jaypan commentedI had the same error, and this patch fixed it.
Comment #5
floown CreditAttribution: floown commentedHello,
I had the same error in Apache logs:
[Thu Dec 28 20:42:04.251806 2017] [php7:notice] [pid 31123] [client 163.170.105.159:54426] Uncaught PHP Exception Twig_Error_Loader: "Template "themes/contrib/amptheme/amptheme/templates/amp-skip-link.html.twig" is not defined (Drupal\\Core\\Template\\Loader\\ThemeRegistryLoader: Unable to find template "themes/contrib/amptheme/amptheme/templates/amp-skip-link.html.twig" in the Drupal theme registry.)." at /home/admin/web/dev.domain.com/public_html/web/themes/contrib/amptheme/amptheme/templates/layout/html.html.twig line 42
I have apply the patch:
but now I have:
[Thu Dec 28 20:42:31.946241 2017] [php7:notice] [pid 31121] [client 163.170.105.159:54428] Error: Call to a member function attributes() on boolean in /home/admin/web/dev.domain.com/public_html/web/themes/contrib/amptheme/amptheme/amptheme.theme on line 221 #0 /home/admin/web/dev.domain.com/public_html/web/core/lib/Drupal/Core/Theme/ThemeManager.php(287): amptheme_preprocess_block(Array, 'block', Array)\n#1 /home/admin/web/dev.domain.com/public_html/web/core/lib/Drupal/Core/Render/Renderer.php(437): Drupal\\Core\\Theme\\ThemeManager->render('block', Array)\n#2 /home/admin/web/dev.domain.com/public_html/web/core/lib/Drupal/Core/Render/Renderer.php(450): Drupal\\Core\\Render\\Renderer->doRender(Array)\n#3 /home/admin/web/dev.domain.com/public_html/web/core/lib/Drupal/Core/Render/Renderer.php(195): Drupal\\Core\\Render\\Renderer->doRender(Array, false)\n#4 /home/admin/web/dev.domain.com/public_html/web/core/lib/Drupal/Core/Template/TwigExtension.php(490): Drupal\\Core\\Render\\Renderer->render(Array)\n#5 /home/admin/web/dev.domain.com/public_html/web/sites/default/files/php/twig/5a4326305fbad_page.html.twig_ff5Femhp1kzM3aTZyDixDPQt-/Jt1QPgj4A7yK08rjpPW8Pjxc7m4juPUImhC1ENrIy8Y.php(47): Drupal\\Core\\Template\\TwigExtension->escapeFilter(Object(Drupal\\Core\\Template\\TwigEnvironment), Array, 'html', NULL, true)\n#6 /home/admin/web/dev.domain.com/public_html/vendor/twig/twig/lib/Twig/Template.php(432): __TwigTemplate_73a5ce60eb7d2a75d4c17b8d72f9de9d902c727a56fb40d6ab87ad44cb9508b2->doDisplay(Array, Array)\n#7 /home/admin/web/dev.domain.com/public_html/vendor/twig/twig/lib/Twig/Template.php(403): Twig_Template->displayWithErrorHandling(Array, Array)\n#8 /home/admin/web/dev.domain.com/public_html/vendor/twig/twig/lib/Twig/Template.php(411): Twig_Template->display(Array)\n#9 /home/admin/web/dev.domain.com/public_html/web/core/themes/engines/twig/twig.engine(64): Twig_Template->render(Array)\n#10 /home/admin/web/dev.domain.com/public_html/web/core/lib/Drupal/Core/Theme/ThemeManager.php(384): twig_render_template('themes/contrib/...', Array)\n#11 /home/admin/web/dev.domain.com/public_html/web/core/lib/Drupal/Core/Render/Renderer.php(437): Drupal\\Core\\Theme\\ThemeManager->render('page', Array)\n#12 /home/admin/web/dev.domain.com/public_html/web/core/lib/Drupal/Core/Render/Renderer.php(195): Drupal\\Core\\Render\\Renderer->doRender(Array, false)\n#13 /home/admin/web/dev.domain.com/public_html/web/core/lib/Drupal/Core/Template/TwigExtension.php(490): Drupal\\Core\\Render\\Renderer->render(Array)\n#14 /home/admin/web/dev.domain.com/public_html/web/sites/default/files/php/twig/5a4326305fbad_html.html.twig_7eViIFHH4zHZfLSAhM4QF99ct/aPtpbbvmb38QyHrMngOXlQgVF__8PQB8YpxjLn7A094.php(99): Drupal\\Core\\Template\\TwigExtension->escapeFilter(Object(Drupal\\Core\\Template\\TwigEnvironment), Array, 'html', NULL, true)\n#15 /home/admin/web/dev.domain.com/public_html/vendor/twig/twig/lib/Twig/Template.php(432): __TwigTemplate_eb3ca6721f62a910a396a966bb35c1df55ec930d40492f412ad73509542c1454->doDisplay(Array, Array)\n#16 /home/admin/web/dev.domain.com/public_html/vendor/twig/twig/lib/Twig/Template.php(403): Twig_Template->displayWithErrorHandling(Array, Array)\n#17 /home/admin/web/dev.domain.com/public_html/vendor/twig/twig/lib/Twig/Template.php(411): Twig_Template->display(Array)\n#18 /home/admin/web/dev.domain.com/public_html/web/core/themes/engines/twig/twig.engine(64): Twig_Template->render(Array)\n#19 /home/admin/web/dev.domain.com/public_html/web/core/lib/Drupal/Core/Theme/ThemeManager.php(384): twig_render_template('themes/contrib/...', Array)\n#20 /home/admin/web/dev.domain.com/public_html/web/core/lib/Drupal/Core/Render/Renderer.php(437): Drupal\\Core\\Theme\\ThemeManager->render('html', Array)\n#21 /home/admin/web/dev.domain.com/public_html/web/core/lib/Drupal/Core/Render/Renderer.php(195): Drupal\\Core\\Render\\Renderer->doRender(Array, false)\n#22 /home/admin/web/dev.domain.com/public_html/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(147): Drupal\\Core\\Render\\Renderer->render(Array)\n#23 /home/admin/web/dev.domain.com/public_html/web/core/lib/Drupal/Core/Render/Renderer.php(576): Drupal\\Core\\Render\\MainContent\\HtmlRenderer->Drupal\\Core\\Render\\MainContent\\{closure}()\n#24 /home/admin/web/dev.domain.com/public_html/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(148): Drupal\\Core\\Render\\Renderer->executeInRenderContext(Object(Drupal\\Core\\Render\\RenderContext), Object(Closure))\n#25 /home/admin/web/dev.domain.com/public_html/web/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php(90): Drupal\\Core\\Render\\MainContent\\HtmlRenderer->renderResponse(Array, Object(Symfony\\Component\\HttpFoundation\\Request), Object(Drupal\\Core\\Routing\\CurrentRouteMatch))\n#26 /home/admin/web/dev.domain.com/public_html/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(108): Drupal\\Core\\EventSubscriber\\MainContentViewSubscriber->onViewRenderArray(Object(Symfony\\Component\\HttpKernel\\Event\\GetResponseForControllerResultEvent), 'kernel.view', Object(Drupal\\Component\\EventDispatcher\\ContainerAwareEventDispatcher))\n#27 /home/admin/web/dev.domain.com/public_html/vendor/symfony/http-kernel/HttpKernel.php(158): Drupal\\Component\\EventDispatcher\\ContainerAwareEventDispatcher->dispatch('kernel.view', Object(Symfony\\Component\\HttpKernel\\Event\\GetResponseForControllerResultEvent))\n#28 /home/admin/web/dev.domain.com/public_html/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\\Component\\HttpKernel\\HttpKernel->handleRaw(Object(Symfony\\Component\\HttpFoundation\\Request), 1)\n#29 /home/admin/web/dev.domain.com/public_html/web/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\\Component\\HttpKernel\\HttpKernel->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#30 /home/admin/web/dev.domain.com/public_html/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\\Core\\StackMiddleware\\Session->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#31 /home/admin/web/dev.domain.com/public_html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(184): Drupal\\Core\\StackMiddleware\\KernelPreHandle->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#32 /home/admin/web/dev.domain.com/public_html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(121): Drupal\\page_cache\\StackMiddleware\\PageCache->fetch(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#33 /home/admin/web/dev.domain.com/public_html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(75): Drupal\\page_cache\\StackMiddleware\\PageCache->lookup(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#34 /home/admin/web/dev.domain.com/public_html/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\\page_cache\\StackMiddleware\\PageCache->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#35 /home/admin/web/dev.domain.com/public_html/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(50): Drupal\\Core\\StackMiddleware\\ReverseProxyMiddleware->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#36 /home/admin/web/dev.domain.com/public_html/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\\Core\\StackMiddleware\\NegotiationMiddleware->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#37 /home/admin/web/dev.domain.com/public_html/web/core/lib/Drupal/Core/DrupalKernel.php(657): Stack\\StackedHttpKernel->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#38 /home/admin/web/dev.domain.com/public_html/web/index.php(19): Drupal\\Core\\DrupalKernel->handle(Object(Symfony\\Component\\HttpFoundation\\Request))\n#39 {main}
I have made a
drush cr
When I add ?amp in a url, I have : "The website encountered an unexpected error. Please try again later."
What can I do?
Comment #6
floown CreditAttribution: floown commentedComment #7
Jaypan CreditAttribution: Jaypan commentedThat issue is separate from this one, as can be seen from the debug log. It would appear the patch did fix the problem you were having, and now you are having a different problem.
Comment #8
Jon PughRan into this. Marking this critical, as it completely breaks the site.
Patch works as expected.
Comment #10
KarenS CreditAttribution: KarenS at Lullabot commentedCommitted. Thanks all!
Comment #11
KarenS CreditAttribution: KarenS at Lullabot commentedComment #13
floown CreditAttribution: floown commentedThe problem still exist in: amptheme 3.x-dev 9fa3af0
Comment #14
Shawn Conn CreditAttribution: Shawn Conn at Luciditi commentedAs @floown mentions, the 3.x branch does have a similar (but different issue). Changing the template location from
navigation/amp-skip-link
toamp-skip-link
fixes the issue.Comment #15
Vinay15Since this issue is Closed (fixed), submitting a patch here would go unnoticed. Created a new issue Template "themes/contrib/amptheme/amptheme/templates/navigation/amp-skip-link.html.twig" is not defined. and submitted a patch there.