0

After creating a new paragraph type and its template file in the correct folder location, I am receiving the following error every time I view the page with that houses the new paragraph type.

Twig_Error_Loader: Template "file.html.twig" is not defined (Drupal\Core\Template\Loader\ThemeRegistryLoader: Unable to find template "file.html.twig" in the Drupal theme registry.)

I have followed the steps here to disable the cache. However I don't believe it worked because I still have to clear my cache through config>performance for changes to twig files to appear.

Similarly, I tried to enable twig debugging (and turn off caching) here and can not confirm that it has been enabled either.

I found an article: blog.wturrell.co.uk/troubleshooting-drupalcoretemplateloaderthemeregistryloader-unable-to-find-template/ discussing potentially clearing the theme-registry, but I do not have access to drush to run any commands.

I have already tried clearing all the cache from within drupal itself.

1

Cache is a pretty broad concept, and sometimes mean content caching and sometimes they mean broader things like config settings and the theme registry. Disabling content caching is still a bit confusing to me so I can't help with that part of the question.

But the theme registry has some pretty simple rules. If you add new template file (or change it's name or move it to a different folder) or if you add a new theme callback (in hook_theme) or override to a theme callback (hook_preprocess...) then you MUST clear the theme registry before they will be active. To do that, the simplest method (without additional modules or drush) is to 'Clear all caches' under admin->config->development->performance.

Of note, sometimes the theme registry is referred to as the theme cache. While I know it's probably possible, I don't think that disabling the theme registry from caching is a standard practice in development.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.