heimrichhannot / contao-filter-bundle
A generic contao filter.
Installs: 9 433
Dependents: 3
Suggesters: 2
Security: 0
Stars: 4
Watchers: 6
Forks: 1
Open Issues: 4
Type:contao-bundle
Requires
- php: ^8.0
- ext-pdo: *
- ausi/slug-generator: ^1.0
- codefog/contao-haste: ^4.18 || ^5.0
- codefog/tags-bundle: ^2.0 || ^3.3
- contao/core-bundle: ^4.13 || ^5.0
- heimrichhannot/contao-be_explanation-bundle: ^2.5@beta
- heimrichhannot/contao-encore-contracts: ^1.0
- heimrichhannot/contao-entity-filter-bundle: ^1.11@beta
- heimrichhannot/contao-fieldpalette-bundle: ^0.6.12 || ^1.0@beta
- heimrichhannot/contao-multi-column-editor-bundle: ^2.0
- heimrichhannot/contao-utils-bundle: ^2.226 || ^3.0
- symfony/config: ^4.4 || ^5.0 || ^6.0
- symfony/dependency-injection: ^4.4 || ^5.0 || ^6.0
- symfony/event-dispatcher: ^4.4 || ^5.0 || ^6.0
- symfony/event-dispatcher-contracts: ^1.0 || ^2.0 || ^3.0
- symfony/form: ^4.4 || ^5.0 || ^6.0
- symfony/framework-bundle: ^4.4 || ^5.0 || ^6.0
- symfony/http-foundation: ^4.4 || ^5.0 || ^6.0
- symfony/http-kernel: ^4.4 || ^5.0 || ^6.0
- symfony/intl: ^4.4 || ^5.0 || ^6.0
- symfony/options-resolver: ^4.4 || ^5.0 || ^6.0
- symfony/property-access: ^4.4 || ^5.0 || ^6.0
- symfony/routing: ^4.4 || ^5.0 || ^6.0
- symfony/translation: ^4.4 || ^5.0 || ^6.0
- symfony/translation-contracts: ^1.0 || ^2.0 || ^3.0
- twig/extra-bundle: ^3.0
- twig/html-extra: ^2.12 || ^3.0
- twig/intl-extra: ^2.12 || ^3.0
- twig/string-extra: ^2.12 || ^3.0
Requires (Dev)
- contao/manager-plugin: ^2.0
- contao/test-case: 1.1.*
- friendsofphp/php-cs-fixer: ^2.2
- heimrichhannot/contao-categories-bundle: ^1.0-beta
- heimrichhannot/contao-test-utilities-bundle: ^0.1
- php-coveralls/php-coveralls: ^2.0
- php-http/guzzle6-adapter: ^1.1
- php-http/message-factory: ^1.0.2
- phpunit/phpunit: ^6.5
- symfony/phpunit-bridge: ^3.2
Conflicts
- contao/core: *
- contao/manager-plugin: <2.0 || >=3.0
- heimrichhannot/contao-blocks: <2.0@beta
- dev-master
- 2.0.0-beta1
- 1.30.4
- 1.30.3
- 1.30.2
- 1.30.1
- 1.30.0
- 1.29.0
- 1.28.5
- 1.28.4
- 1.28.3
- 1.28.2
- 1.28.1
- 1.28.0
- 1.27.2
- 1.27.1
- 1.27.0
- 1.26.0
- 1.25.9
- 1.25.8
- 1.25.7
- 1.25.6
- 1.25.5
- 1.25.4
- 1.25.3
- 1.25.2
- 1.25.1
- 1.25.0
- 1.24.0
- 1.23.7
- 1.23.6
- 1.23.5
- 1.23.4
- 1.23.3
- 1.23.2
- 1.23.1
- 1.23.0
- 1.22.6
- 1.22.5
- 1.22.4
- 1.22.3
- 1.22.2
- 1.22.1
- 1.22.0
- 1.21.3
- 1.21.2
- 1.21.1
- 1.21.0
- 1.20.7
- 1.20.6
- 1.20.5
- 1.20.4
- 1.20.3
- 1.20.2
- 1.20.1
- 1.20.0
- 1.19.3
- 1.19.2
- 1.19.1
- 1.19.0
- 1.18.1
- 1.18.0
- 1.17.0
- 1.16.0
- 1.15.0
- 1.14.0
- 1.13.2
- 1.13.1
- 1.13.0
- 1.12.3
- 1.12.2
- 1.12.1
- 1.12.0
- 1.11.3
- 1.11.2
- 1.11.1
- 1.11.0
- 1.10.2
- 1.10.1
- 1.10.0
- 1.9.3
- 1.9.2
- 1.9.1
- 1.9.0
- 1.8.1
- 1.8.0
- 1.7.0
- 1.6.8
- 1.6.7
- 1.6.6
- 1.6.5
- 1.6.4
- 1.6.3
- 1.6.2
- 1.6.1
- 1.5.4
- 1.5.3
- 1.5.2
- 1.5.1
- 1.5.0
- 1.4.1
- 1.4.0
- 1.3.1
- 1.3.0
- 1.2.10
- 1.2.9
- 1.2.8
- 1.2.7
- 1.2.6
- 1.2.5
- 1.2.4
- 1.2.3
- 1.2.2
- 1.2.1
- 1.2.0
- 1.1.2
- 1.1.1
- 1.1.0
- 1.0.1
- 1.0.0
- 1.0.0-beta130.2
- 1.0.0-beta130.1
- 1.0.0-beta130
- 1.0.0-beta129.1
- 1.0.0-beta129
- 1.0.0-beta128.7
- 1.0.0-beta128.6
- 1.0.0-beta128.5
- 1.0.0-beta128.4
- 1.0.0-beta128.3
- 1.0.0-beta128.2
- 1.0.0-beta128.1
- 1.0.0-beta128
- 1.0.0-beta127
- 1.0.0-beta126
- 1.0.0-beta125
- 1.0.0-beta124
- 1.0.0-beta123
- 1.0.0-beta122
- 1.0.0-beta121
- 1.0.0-beta120
- 1.0.0-beta119
- 1.0.0-beta118
- 1.0.0-beta117
- 1.0.0-beta116
- 1.0.0-beta115
- 1.0.0-beta114
- 1.0.0-beta113
- 1.0.0-beta112
- 1.0.0-beta111
- 1.0.0-beta110
- 1.0.0-beta109
- 1.0.0-beta108
- 1.0.0-beta107
- 1.0.0-beta106
- 1.0.0-beta105
- 1.0.0-beta104
- 1.0.0-beta103
- 1.0.0-beta102
- 1.0.0-beta101
- 1.0.0-beta100
- 1.0.0-beta99
- 1.0.0-beta98
- 1.0.0-beta97
- 1.0.0-beta96
- 1.0.0-beta95
- 1.0.0-beta94
- 1.0.0-beta93
- 1.0.0-beta92
- 1.0.0-beta91
- 1.0.0-beta90
- 1.0.0-beta89
- 1.0.0-beta88
- 1.0.0-beta87
- 1.0.0-beta86
- 1.0.0-beta85
- 1.0.0-beta84
- 1.0.0-beta83
- 1.0.0-beta82
- 1.0.0-beta81
- 1.0.0-beta80
- 1.0.0-beta79
- 1.0.0-beta78
- 1.0.0-beta77
- 1.0.0-beta76
- 1.0.0-beta75
- 1.0.0-beta74
- 1.0.0-beta73
- 1.0.0-beta72
- 1.0.0-beta71
- 1.0.0-beta70
- 1.0.0-beta69
- 1.0.0-beta68
- 1.0.0-beta67
- 1.0.0-beta66
- 1.0.0-beta65
- 1.0.0-beta64
- 1.0.0-beta63
- 1.0.0-beta62
- 1.0.0-beta61
- 1.0.0-beta60
- 1.0.0-beta59
- 1.0.0-beta58
- 1.0.0-beta57
- 1.0.0-beta56
- 1.0.0-beta55
- 1.0.0-beta54
- 1.0.0-beta53
- 1.0.0-beta52
- 1.0.0-beta51
- 1.0.0-beta50
- 1.0.0-beta49
- 1.0.0-beta48
- 1.0.0-beta47
- 1.0.0-beta46
- 1.0.0-beta45
- 1.0.0-beta44
- 1.0.0-beta43
- 1.0.0-beta42
- 1.0.0-beta41
- 1.0.0-beta40
- 1.0.0-beta39
- 1.0.0-beta38
- 1.0.0-beta37
- 1.0.0-beta36
- 1.0.0-beta35
- 1.0.0-beta34
- 1.0.0-beta33
- 1.0.0-beta32
- 1.0.0-beta31
- 1.0.0-beta30
- 1.0.0-beta29
- 1.0.0-beta28
- 1.0.0-beta27
- 1.0.0-beta26
- 1.0.0-beta25
- 1.0.0-beta24
- 1.0.0-beta23
- 1.0.0-beta22
- 1.0.0-beta21
- 1.0.0-beta20
- 1.0.0-beta19
- 1.0.0-beta18
- 1.0.0-beta17
- 1.0.0-beta16
- 1.0.0-beta15
- 1.0.0-beta14
- 1.0.0-beta13
- 1.0.0-beta12
- 1.0.0-beta11
- 1.0.0-beta10
- 1.0.0-beta9
- 1.0.0-beta8
- 1.0.0-beta7
- 1.0.0-beta6
- 1.0.0-beta5
- 1.0.0-beta4
- 1.0.0-beta3
- 1.0.0-beta2
- 1.0.0-beta1
- 1.0.0-beta
- dev-contao5
- dev-feature/newscategories
- dev-encore-contracts
- dev-feature/filter_preselect_options
- dev-feature/contao49
- dev-fix/invalidDataTypesOutdatedValues
- dev-filter-type-refactoring
- dev-feature/hide_label_check
- dev-fix/sql_type_intial
This package is auto-updated.
Last update: 2024-11-22 08:21:00 UTC
README
This bundle offers a generic filter module to use with arbitrary contao entities containing standard filter with initial filters and filter form types including symfony form type representations.
Features
- Form handling using symfony form component
- Form rendering by using symfony form templates (currently available: bootstrap 3-5, foundation, div, table)
- Numerous symfony form types supported
- Highly customizable and detached from tl_module table
- Label/Message handling using symfony translations
- Render form always empty (without user selection)
- Merge data over multiple filter forms with same form name
- Default Values (can be overwritten by user)
- Initial Values (can`t be overwritten by user)
- Stores filter data in session (no GET parameter URL remnant)
- Content element "Filter-Preselect" with optional redirect functionality to preselect filter on given page
- Content element "Filter-Hyperlink" with filter preselect feature
- Integrations:
codefog/contao-news_categories
codefog/tags-bundle
heimrichhannot/contao-categories-bundle
heimrichhannot/contao-encore-bundle
Usage
Install
-
Install with composer or contao manager
composer require heimrichhannot/contao-filter-bundle
-
Update database
We recommend to use this bundle toghether with List Bundle and Reader Bundle.
Setup
- Create a filter configuration within System -> Filter & sort configuration
- Add filter elements to the filter config.
- If you want to show the filter somewhere (for example to filter a list), create a filter/sort frontend module.
Wrapper elements (DateRange, ProximitySearch, ...)
The Wrapper element has to be places before the fields associated with them. For example the date_range wrapper element needs to be placed before the two associated date fields.
Preselect
Filter Bundle Forms are not typical GET-Forms, so it is not possible to simple copy the filter urls to share or bookmark a filtered list. To overcome this limitation, preselect urls can be generated. Preselect urls for the current filter can be found within template variabled, you can create a preselect content element or get the url programmatically from the FilterConfig.
Template variables
If a filter is set, the variable preselectUrl
contains the preselection url for
the current filter. It's available in the filter templates and the frontend module
template.
You can for example create a copy preselect url button:
{% if preselectUrl is defined and preselectUrl is not empty %} <div class="col-xd-12 col-md-3"> <a class="btn btn-primary" onclick="navigator.clipboard.writeText('{{ preselectUrl }}');alert('Copied preselect link!');return false;">Filtervorauswahllink kopieren</a> </div> {% endif %}
Content element
You can use one of the following content elements:
- "Filter-Preselect" with optional redirect functionality to preselect filter on given page
- "Filter-Hyperlink" with filter preselect feature
FilterConfig
You can generate the preselect link from the FilterConfig instance
<?php use HeimrichHannot\FilterBundle\Manager\FilterManager; class CustomController { private FilterManager $filterManager; public function invoke(): string { $filterConfig = $this->filterManager->findById($this->objModel->filter); return !empty($filterConfig->getData()) ? $filterConfig->getPreselectAction($filterConfig->getData(), true) : '' } }