-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Sonata 4.0.0-alpha-1 / How to add custom form theme? #7104
Comments
Hi @virtualize. If you want to help you can implement a Until then, you can call |
Thanks @VincentLanglet the configure method is what I was looking for. I'm willing to create a PR for the docs if you point me to where this belongs (e.g. as a recipe or in reference). Regarding #6866: Although I've seen how its done in the SonataDoctrineORMAdminBundle/AddTemplatesCompilerPass I don't really understand whats happening there or if it is the "right" we to do. |
Sorry your suggestion to use an admins sonata_doctrine_orm_admin:
templates:
form:
# Default:
- @SonataDoctrineORMAdmin/Form/form_admin_fields.html.twig If I add my form theme there its works |
Nice catch.
should be deprecated, in favor of
|
So @VincentLanglet we need an Or maybe another way could be to change priorities of the compiler passes to ensure that the |
This is already the case IMHO, the compiler pass run before the configure method.
It could be needed for https://github.com/sonata-project/SonataDoctrineORMAdminBundle/blob/83ca012bdfa8585ea35c30ef8ffece0eefdd7a81/src/DependencyInjection/Compiler/AddTemplatesCompilerPass.php#L39-L41 But there is a
|
@VincentLanglet no this is not the case. At least not on my project using 3.x. Here an example for one admin of all method calls added with Symfony DI:
So the |
Indeed, but it's because This is wrong a called should be done in the admin and then, the call should be overridden in the persistence bundle if needed. But adding a priority to Do you want to make a PR for the two-in-one SonataAdmin bugfix ? |
@virtualize this has been fixed & released on 3.x (not yet on 4.x). you can now set the templates properly in the public function configure(): void
{
$this->setFormTheme(...);
} Thanks for reporting it 👍 |
Environment
Sonata packages
show
Symfony packages
show
PHP version
Subject
In Sonata v3 we did this
But in Sonata 4
getFormTheme()
is declared final in AbstractAdmin which we're extending from.What is the (new) suggested way to add a custom form theme? Is there one?
The text was updated successfully, but these errors were encountered: