File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33A list filter is an implementation that defines how an a filter input has to be rendered. This works together with the
44` AdminRepository ` that receives the submitted form that was built using list filter types.
55
6+ Using filters, you can implement customized search based on any field of your entities, although those already
7+ provided ` text ` and ` date ` may be enough for most project, perhaps you will need to customize or create more complex
8+ filters for your project specific business logic.
9+
6101 . Create a new class implementing ` LIN3S\AdminBundle\Configuration\Type\ListFilterType `
7111 . Add the class to Dependency Container with ` lin3s_admin.list_filter_type ` tag name and the desired alias.
8121 . Reference the created service with the alias in the property ` type ` of list > filters > field_name of your ` admin.yml `
913
1014## Render function
1115
12- > TODO
16+ You can handle the header representation of the row within this function, these are the parameters available:
17+ * filter: A ` ListFilter ` entity of the filter.
18+ * currentValue: The value to be filtered.
19+ * options: An array of options.
20+
21+ Text filter example:
22+
23+ ``` php
24+ $attributes = $currentValue !== null ? ' value="' . $currentValue . '"' : '';
25+
26+ foreach ($options['attrs'] as $attrName => $attr) {
27+ $attributes .= ' ' . $attrName . '="' . $attr . '"';
28+ }
29+
30+ return sprintf('<input %s type =" text" data-filter-field =" %s" >', $attributes, $filter->field());
31+ ```
32+
33+
You can’t perform that action at this time.
0 commit comments