-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[FrameworkBundle][Twig] findAllTemplates not returning all templates #25811
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I confirm that the system for overwriting bundle templates in the new You can test with TwigBundle: If you add your custom template On the other hand, if you add the custom template 'TwigBundle:Exception:exception_full.html.twig' => __DIR__.'/../../../vendor/symfony/twig-bundle/Resources/views/Exception/exception_full.html.twig', and not: 'TwigBundle:Exception:exception_full.html.twig' => __DIR__.'/../../../templates/bundles/TwigBundle/Exception/exception_full.html.twig', Of course, the Twig config is: twig:
debug: "%kernel.debug%"
strict_variables: "%kernel.debug%"
paths:
- "%kernel.project_dir%/templates" I have a functional solution, but it modifies the files:
to detect if it's a overridden template of bundle in the However, I do not know if it's the best approach, and if it is not better to create a custom file locator extending the What is the approach you want so that I can propose a PR? |
I think this was fixed by #27764 |
That is actually a great fix. There appears to be some duplicate/similar code within Symfony between the |
@francoispluchino if you're using the Templating component you should enabling the Twig engine to make it work with the Twig paths and convention: framework:
templating:
engines: ['twig'] @nicoschoenmaker The |
@fabpot this can be closed |
Uh oh!
There was an error while loading. Please reload this page.
TL;DR;
Symfony\Bundle\FrameworkBundle\CacheWarmer\TemplateFinder
doesn't find templates inside thetemplates/
folder.This is because the
TemplateFinder
is unaware of thepaths
setting in thetwig
config. Changing the default directory structure in Symfony 4 means this setting is used more often now.Related issue: #21035
Example usage in the wild: Tracker
Steps to reproduce:
composer create-project symfony/skeleton my_project cd my_project composer require templating twig frameworkbundle
Add to
config/services.yaml
Add to
src/Controller/MyController.php
Add to
config/routes.yaml
Finally, add to
templates/templates.html.twig
Expected:
base.html.twig
andtemplates.html.twig
part of the outputResult: Only files inside the
FrameworkBundle
andTwigBundle
found.The text was updated successfully, but these errors were encountered: