$ composer show sonata-project/*
sonata-project/admin-bundle 3.3.2 The missing Symfony Admin Generator
sonata-project/block-bundle 3.0.1 Symfony SonataBlockBundle
sonata-project/cache 1.0.7 Cache library
sonata-project/core-bundle 3.0.3 Symfony SonataCoreBundle
sonata-project/doctrine-orm-admin-bundle 3.0.4 Symfony Sonata / Integrate Doctrine ORM into...
sonata-project/exporter 1.5.0 Lightweight Exporter library
SonataAdminBundle:CRUD:base_list.html.twig list_filters block overwrites (line 226) the filter theme set in CRUDController:108
Add any custom form theme to the datagrid filters through an Admin class. e.g.:
public function getFilterTheme() {
return array_merge(parent::getFilterTheme(), [
'SonataCoreBundle:Form:datepicker.html.twig'
]);
}
Form rendered correctly

Custom form theme ignored. Form is rendered with default theme.

Thanks for the report @fracsi.
Does it happen only for filters?
@Soullivaneuh Yes it only affects filters.
could add some screenshots?
And the Admin class with the corresponding used field please.
@OskarStark @Soullivaneuh
I wanted to use date_range filter with datepicker, so in the admin:
$datagridMapper
->add('date', 'doctrine_orm_date_range', [
'label' => 'Date',
'field_type' => 'sonata_type_date_range_picker',
'field_options' => [
'field_options_start' => [
'label' => 'Date start'
],
'field_options_end' => [
'label' => 'Date end'
]
]
]);
And:
public function getFilterTheme()
{
return array_merge(parent::getFilterTheme(), [
'SonataCoreBundle:Form:datepicker.html.twig'
]);
}
Actual result:

Expected result:

Bug confirmed.
Indeed, removing this line solve the issue: https://github.com/sonata-project/SonataAdminBundle/blob/3.3.2/Resources/views/CRUD/base_list.html.twig#L226
This line seems to be introduced a long time ago in https://github.com/sonata-project/SonataAdminBundle/commit/2d4b2311ef47f24a7b0c3c52856554ec44f3f0c6 by @Bladrak and modified in #2061 by @boajer.
Could you please guys give us some hints?
This can be done with configuration:
sonata_admin:
templates:
filter: SonataCoreBundle:Form:datepicker.html.twig
But this limits the choice to one template, not an array.
BTW, why putting this with configuration when this can be done with the Admin class?
I added the screenshots to the PR header
Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
Most helpful comment
I added the screenshots to the PR header