-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[RFC] Use only the native template overriding mechanism of Symfony? #1749
Comments
I like that:
I don't like that:
I don't know:
|
so basically, if I want to override the view template for all entities, I will no longer be able to do so? |
I don't understand what do you mean really, but it's just as works the current path convention for
What template doesn't exists? :/
I'm not sure what case is it, you're refering to default templates? it'll be possible in the same way that now.
No problem anymore, this issue can be resolved adding a second Twig's namespace for twig:
paths:
vendor/javiereguiluz/easyadmin-bundle/Resources/views: !EasyAdmin then in {% extends '@!EasyAdmin/default/layout.html.twig' %}
More info about which is the source of the issue here https://stackoverflow.com/questions/45220467/how-can-i-override-partially-a-third-party-template My intention is make the overriding template mechanism of the bundle like native. Currently, "without configuration" we can override any template from any bundle, only we need make the path convention: So it implies that If you want a different place to override these templates then use Twig's paths: twig:
paths:
# syntax <relative or realpath> : <bundle namespace>
custom/path: EasyAdmin and it's enough to override any default template from another location ( Now, how can I override a template from one entity? (Currently)
In this case the convention wins (one step less), but you need a new dir I hope it help! |
In the next release of twig an exception should be thrown on circular template reference twigphp/Twig#2530 :) |
I'm closing this issue because we're starting a new phase in the history of this bundle (see #2059). We've moved it into a new GitHub organization and we need to start from scratch: no past issues, no pending pull requests, etc. I understand if you are angry or disappointed by this, but we really need to "reset" everything in order to reignite the development of this bundle. |
This is a proposal from @yceruto explained in this comment and copied below:
What about to use only the standard (native) overriding templates mechanism?
For example, installing a fresh EasyAdminBundle with the next configuration:
I want to customize the
User
list template just creating the path convention:Later with nothing more the bundle should be able to load
@EasyAdmin/User/list.html.twig
template for User/list action and so on.To achieve it, the next template paths should be enough to cover all cases:
@EasyAdmin/<entityName>/<templateName>.html.twig
(set only if exists else use default template)@EasyAdmin/default/<templateName>.html.twig
Also, instead of hardcode the
easy_admin
directory (AFAIR workaround to well known issue symfony/symfony#17557) you can add a second Twig's namespace automatically forEasyAdminBundle/Resources/views
e.g. '!EasyAdmin' as you're suggested.Why?
Less paths to do the same => less issues, less options to document & remember, less steps, less code to maintain, bundle-less methods in favor of native methods.
WDYT? Thanks!
See patch (without BC layer):
The text was updated successfully, but these errors were encountered: