Using the debug function I have found only one template suggestion for view's exposed form:


I need to make changes to particular view, but I dont have other default suggestions like:


Should I write a function like hook_views_exposed_form_alter()

1 Answer 1

  1. create exposed form filters template following this naming standard:

    to get the view-name you can get from Backoffice (Structure > Views > search for your view > then get machine name and repalce the underscore with dash - see image bellow)

    enter image description here
    so we get this template:

  2. put your static HTML(we will replace in next step) there and clear cache you'll find the new tempalte.

  3. if you want to print the exposed fitlers just put {{form} in your tempalte


  4. but if you want to print each exposed fitler serpately follow this steps : (Structure > Views> search for your view > Edit > click on filter name under the FILTER CRITERIA > scroll down and copy Filter identifier input value > go back to the template and print your exposed filter one by one {{ form.$fitler name }}


    {#1.print 1st exposed fitler form element + label #}
    {{ form.field_thematiques_target_id }}
    {#2.print 2nd form element + label #}
    {{ form.field_type_media_value }}
    {#3.include all other form elment ex submit button but to prevent 
    duplication remove other one #}
    {{ form|without('field_thematiques_target_id','field_type_media_value') }}
  • 1
    Thank you, I can also use views-exposed-form--{view-name}--{display-name}.html.twig
    – user97394
    Commented Jan 16, 2020 at 7:10

Your Answer

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