-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Profiler] rendered templates always show the vendor one. #27911
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
IMO that's expected. What you see here is the template name. To which path that is resolved depends on which template files actually do exist in your application. Maybe we could add another column including the filename relative to the project directory though. |
That's because |
Thanks for your answer. |
The list is clear, these are all "Rendered templates"
I'd say no :) Basically why do you want to know it's a vendor or app template upfront? It's being rendered either way... Not that im against a little hint though, in terms of exposing as much as possible :) |
I think the point about the template name not being a path but only a logical name is quite clear by now. But I also see, that the there is a very valid use case here. If I am debugging an issue with wrong rendering, I want to see at a glance which actual template file was rendered and not just the logical name. Because when searching for a bug, the logical name doesn't help too much. |
that would require extra work, because it would force to look for all potential location for this template name (to see whether there are multiple existing files) instead of just reading the info from the template object. |
Or to be more compact as actual. We can check if the path begins by 'vendor/'. And if not then we can show a little button or message |
I like the proposal by @yceruto, agree a filepath reference is more recognizable then its logical name. Currently you have to hover each link for that. I don't see any real reason to treat vendor/ templates any different then non-vendor templates, e.g. visually. That's not really relevant IMHO. |
I would just take the proposal by @yceruto as is. 👌 |
We could also add a new option to the $ bin/console debug:twig --find=@FOSUser/layout.html.twig
templates/bundles/FOSUserBundle/layout.html.twig (default)
vendor/friendsofsymfony/user-bundle/Resources/views/layout.html.twig We would see all the possible templates that match the given name and the search could be easier. |
Proposal #27978 to improve the Twig panel is ready ;) |
and see #27981 for a debug command ;) |
… and improving panel view (yceruto) This PR was merged into the 4.2-dev branch. Discussion ---------- [WebProfilerBundle] Show relative path of the template and improving panel view | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #27911 | License | MIT | Doc PR | - | Before | After | | --- | --- | |  |  | #27978 (comment): | Before | After | | --- | --- | |  |  |  |  | In addition, I added some visual improvements. Commits ------- bcd8058 Show relative path of the template and improving panel view
…wig command to find their paths (yceruto) This PR was squashed before being merged into the 4.2-dev branch (closes #27981). Discussion ---------- [TwigBridge] Added template "name" argument to debug:twig command to find their paths | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #27911 | License | MIT | Doc PR | symfony/symfony-docs#10232 Find the template file (to load by Twig) from a given template name (useful to know which file will be loaded exactly and which ones don't):  This will also show the overridden files if they exist and the paths corresponding to their namespace. In addition, the command suggests alternatives if you made a typo (this way you can check your template name quickly): | namespace typo | template name typo | | --- | --- | |  |  | <details> <summary><strong>Other outputs</strong></summary> Discovering more alternatives:  Unknown template name:  </details> ## Update The feature was introduced into `debug:twig` command and the `filter` argument was converted to `--filter` option. The `name` argument is now the first one of the command. Commits ------- 7ef3d39 [TwigBridge] Added template \"name\" argument to debug:twig command to find their paths
Symfony version(s) affected: 4.1
Description
In the Web-Profiler component the section 'Rendered Templates' seems to show the template from vendor when we override one of them
When we mouse-on the template, the path is good (to the vendor directory or the overriden one) but the label always show @FOSUser/layout.html.twig.
Is there any issue here ? it's difficult to really see which templates are rendered.
Maybe an @app/@FOSUser/layout.html.twig can help to show overriden files ?
How to reproduce
I tried with the FOSUserBundle layout.thig file.
The base template is vendor/friendsofsymfony/user-bundle/Resources/views/layout.html.twig
I override this template in the following directory : templates/bundles/FOSUserBundle/layout.html.twig
Please, have a look at the screenshots.
Additional context

From app directory:
From vendor:

The text was updated successfully, but these errors were encountered: