When I create a view (block) and create an exposed filter I have the choice of a Filter type to expose between

  • Single filter and
  • Grouped filters

enter image description here

If I choose the Grouped filters I am presented with an option to chose the Widget type

  • Radios or
  • Select

enter image description here

But if I chose the default Filter type the form lacks the Widget type option.

I cannot think of any reason why the regular exposed filters shouldn't have this widget type option to chose from.

Can anyone tell me ...

  • Is there a reason for this?
  • Is there any patch that I didn't find until now that fixes this/add's the feature?


There is a hard coded switch in the Drupal core which automatically changes the widget type from checkboxes/radios to select based on the number of options regardless of the Widget type settings in the views form (1-4 options: radios, 5+: select). That issue is patched here: Grouped exposed filter with "Allow multiple selections" ignores widget setting


I don't want the alpha version of Better Exposed Filters module like suggested by some.

  • 3
    Have you installed Better Exposed Filters?
    – Clive
    Commented Oct 1, 2019 at 11:05
  • 1
    @Clive No I didn't. And I won't as long it is an alpha version.
    – yunzen
    Commented Oct 1, 2019 at 11:18
  • 3
    @yunzen I'd suggest using Better Exposed Filters just like the 43,662 other sites using it :)
    – user72672
    Commented Oct 4, 2019 at 18:55
  • What kind of field are you dealing with? Is it a list field, an entity reference field or some other kind of field?
    – Jigarius
    Commented Oct 7, 2019 at 13:49
  • 1
    @Jigarius It's both list fields and entity reference (Taxonomy term)
    – yunzen
    Commented Oct 8, 2019 at 6:45

2 Answers 2


There are two questions asked in the OP:

  • What is the reason for not being able to choose the widget type for an exposed filter?

    Space: It seems that Views decide that for you, in the module's wisdom. I find this is a good enough argument, the rest can be handled as wished by a custom filter.

    // Exposed filter: use a select box to save space.

    Source: https://git.drupalcode.org/project/drupal/blob/8.8.x/core/modules/views/src/Plugin/views/filter/BooleanOperator.php#L156

  • Is there any patch that I didn't find until now that fixes this/add's the feature?

    None that I know off, but, this is not something that needs patching I believe; all additional wishes can be handled by a custom views filter plugin.

Good luck in any case!

  • I don't accept the decisions Drupal make's for you. If I can choose the widget type in one place, but can't choose in the other place, which happens to be just one step off. And then IMHO it's part of the philosophy of Drupal that you can do as much as possible through UI. So I don't understand.
    – yunzen
    Commented Oct 11, 2019 at 7:17

I can see two possible solutions to this problem:

Solution 1: Better Exposed Filters

Install the Better Exposed Filters module. There are over 31,227 sites using it at the moment. Don't let the fact that it is in alpha hold you back unless your organization has a policy preventing you from using alpha releases.

Solution 2: Custom Code

If you cannot use Better Exposed Filters for some reason, then write a hook_form_FORM_ID_alter() to modify your views exposed form the way you want.

Sample code

Create a hook_form_FORM_ID_alter() in a custom module. In the example below, the module name is custom_general.

 * Implements hook_form_FORM_ID_alter().
function custom_general_form_views_exposed_form_alter(
  FormStateInterface $form_state,
) {
  $view_data = $form_state->getStorage('view');

  // Content administration.
  if ($view_data['view']->id() === 'VIEW-ID') {
    // Analyze the structure of your form with kint().
    // Say, the field that matters to you is "field_foobar".
    // kint($form); exit;

    if (isset($form['field_foobar']) {
      $form['field_foobar']['#type'] = 'select';
      $form['field_foobar']['#multiple'] = FALSE;
      $form['field_foobar']['#size'] = 1;
      // TODO: Do other things as necessary.
  • How would that custom code look like?
    – leymannx
    Commented Oct 6, 2019 at 16:52
  • 1
    I mean you know that OP won't use alpha, as they said in the comments under their question. Maybe they have fixed minimum stability in their composer.json, maybe they have company-wide guidelines, whatever. So just stating that they can use custom code maybe is not sufficient here.
    – leymannx
    Commented Oct 6, 2019 at 18:31
  • Added sample code.
    – Jigarius
    Commented Oct 10, 2019 at 13:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.