Hi,
i'm trying to define a default value for a list filter dynamically. By dynamically I mean not a value I can add directly in the admin using the datagridValues but using a value determined @runtime.
I've setup a event listener based on the sonata.admin.event.configure.list... In it I've tried to add a filter but even that doesn't work.
Here's how I create and add the filter...
$fieldDescription = $event->getAdmin()->getModelManager()->getNewFieldDescriptionInstance(
$event->getAdmin()->getClass(),
'contentNode.sourceDomain',
array(
'field_type' => 'entity',
'field_options' => array(
'choice_label' => 'displayName',
)
)
);
$event->getAdmin()->addFilterFieldDescription('newFilter', $fieldDescription);
Is there a way to add a filter (and on top of that specifying a default value for it) within this event listener?
Thanks,
Yannick