Adds a views filter select option.
This module allows you to alter a views data field exposed filter widget to be displayed as a select (dropdown) through code only. Can come in handy for custom database tables for selecting existing values instead of using the default textbox input field as an exposed filter.
Use hook_views_data_alter to change the filter id to "dropdownlist".
Used in https://www.drupal.org/project/search_api_tracking admins view.
Then this will generate something like the sort order in the following screenshot:

Usage
$data['search_api_tracking_stats']['sort_order'] = [
'title' => t('Sort order'),
'field' => [
'id' => 'standard',
],
'filter' => [
'id' => 'dropdownlist',
],
];
Note: "id=> dropdownlist".
This wille make the items appear in a dropdownlist.
This module doesn't do anything else must be addressed via code (views.inc - see above)
Supporting organizations:
| Attachment | Size |
|---|---|
| Views filter select | 33.5 KB |
Project information
Maintenance fixes only
Considered feature-complete by its maintainers.501 sites report using this module
- Created by mschudders on , updated
Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.
