Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 293938

Using checkboxes for exposed filters results in zero rows displaying

$
0
0

Using a form_alter to change the display of an exposed form element to a checkbox results in no results until an option has been selected. (This is different behavior that the default multi-select element).

Steps to reproduce:

  1. Clean install of D8 with dummy content (requires devel) (drush si standard -y --account-pass=admin && drush dl devel && drush en devel_generate -y && drush generate-content 50)
  2. Navigate to /admin/structure/views/view/content
  3. Click the "Content: Type" filter to edit it, tick "Allow multiple selections" and press Apply and Save the view.
  4. Add the following to core/themes/seven/seven.theme
    function seven_form_views_exposed_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state) {
      $form['type']['#type'] = 'checkboxes';
    }
    (you may need to clear the cache after this)
  5. Navigate to /admin/content

No results are displayed. If you tick one of the checkboxes, the view works as expected.


Viewing all articles
Browse latest Browse all 293938

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>