This module allows you to change a views exposed filter widget to a select dropdown list through code. This is useful for custom database tables where you want to provide a dropdown of existing values instead of a text input.
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)