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:
Screenshot of view

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: 
AttachmentSize
Views filter select33.5 KB

Project information

Releases