Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Commit

Permalink
Add filter_field_name option (#334)
Browse files Browse the repository at this point in the history
  • Loading branch information
danut007ro authored Oct 7, 2020
1 parent 255dbfb commit 9b2002a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Filter/FilterBuilderUpdater.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ protected function getFilterCondition(FormInterface $form, AbstractType $formTyp
{
$values = $this->prepareFilterValues($form, $formType);
$values += array('alias' => $alias);
$field = trim($values['alias'] . '.' . $form->getName(), '. ');
$field = $form->getConfig()->getAttribute('filter_field_name') ?? trim($values['alias'] . '.' . $form->getName(), '. ');

$condition = null;

Expand Down
1 change: 1 addition & 0 deletions Filter/Form/FilterTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public function configureOptions(OptionsResolver $resolver)
'apply_filter' => null,
'data_extraction_method' => 'default',
'filter_condition_builder' => null,
'filter_field_name' => null,
));
}

Expand Down
4 changes: 4 additions & 0 deletions Resources/doc/filtertypeextension.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ This option is expected to be closure and recieve one parameter which is an inst

See [4.iii section](working-with-the-bundle.md#iii-customize-condition-operator) for examples.

##### The `filter_field_name` option:

This option is used to define the field name on which the condition is applied.

***

Next: [7. Working with other bundles](working-with-other-bundles.md)

0 comments on commit 9b2002a

Please sign in to comment.