I have asked more generally in stack overflow


How can I make my exposed filters look like this?enter image description here

<select data-drupal-selector="edit-field-video-theme-target-id" id="edit-field-video-theme-target-id" name="field_video_theme_target_id" class="form-select"><option value="All" selected="selected">- Tout -</option><option value="9">A*midex</option><option value="11">Bibliothèque</option><option value="10">Relation entreprise</option><option value="8">Université</option></select>

Is it possible to transform select/options to ul/li?

Is it possible to override the template views-exposed-form--videos.html.twig?

  • 1
    Have you tried Better Exposed Filters? If I remember correctly, it has a feature to turn options into clickable links
    – Hudri
    Mar 26, 2018 at 12:34
  • i am not that keen anymore to use alpha versions
    – Matoeil
    Mar 26, 2018 at 13:15

3 Answers 3


There is nothing integrated into drupal at the moment but you can probably use select2Buttons in your theme.

just include it in your theme and in custom javascript you can call


If i understand you correctly you could create a file views-exposed-form--videos.html.twig(I am not sure with the name just check it with twig debug) and add the following code in it

<# add your styled html with attribute name = "field_video_theme_target_id" #>

<ul name="field_video_theme_target_id" class="form-select">
  <li value="All" selected="selected">- Tout -</li>
  <li value="9">A*midex</li>
  <li value="11">Bibliothèque</li>
  <li value="10">Relation entreprise</li>
  <li value="8">Université</li>
{{ form|without('field_video_theme_target_id') }} 
  • it would be good to keep the logic. options are taxonomies from a entity reference field
    – Matoeil
    Mar 26, 2018 at 12:51
  • kint() or dump() the variable field_video_theme_target_id in the twig file. i think you will be able to display the values there using some loop. Mar 26, 2018 at 13:02

It is possible to override the template, you shall just create it in your theme and then clear the cache.

In your new template you can just change the select list to a ul

The template that you want to override may only contain {{ form }}. Then you must find the preprocess function in the module or theme.

  • it does not seem as simple since the template for views exposed form is {{ form }} . How can i go deep inside?
    – Matoeil
    Mar 26, 2018 at 12: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.