0

I have the "Result summary" in the Header for my view however, it is being displayed at the top of the content. I would like it to be displayed in between the search form and the search results. I would like a detailed answer, since I am new to Drupal (8) - I have seen an answer about how to change the position of the header (or footer) using a template.

I can't obviously change it using the admin UI.

I am using Drupal 8.

Thanks!

1

In your custom theme check if there is a templates/views-view.html.twig file

If not you you can get a copy from core/themes/stable/templates/views/views-view.html.twig and modify the position of header section to be below exposed

the content should look similar to the following after your change

...
{{ exposed }}
{% if header %}
  <header>
    {{ header }}
  </header>
{% endif %}
...

This will customize all views in your current installation

If you want to only modify a specific view you can name the file templates/views-view--VIEWNAME.html.twig

Here is more info on the template naming convention

  • Thanks a lot! Appreciate your help! Worked! – Apurva Pathak Oct 11 at 18:59
  • thanks again! After I made the change, I was able to get the "Result Summary" at the desired location. However, it messed with the styling of the sitewide styling of the submit button on that page (color change of the submit button on hover etc.) - I am not sure I understand why. This is happening only on the pages I applied the twig file and header changes. Any clues as to why this could be happening and what I could do? – Apurva Pathak Oct 22 at 17:49
  • You will have to post some specifics in order to be able to understand to what is going on, perhaps open a new issue with your code. Otherwise try replacing your .twig file with the original to see if it makes any difference. If it is indeed there try incorporating one changes at a time and clear cache to see whether you have got it right. – GiorgosK Oct 22 at 17:58
  • There is a style.css in my docroot/themes/<mytheme>/css with the following CSS styling that goes away as soon as I bring the renamed views-view.html.twig file in my views directory. CSS Styling (part of it) div.view-filters div.form-actions > input[type="submit"] { background-color: #df711c ; border: 1px solid #df711c ; border-radius: 3px ; color: #fff; } – Apurva Pathak Oct 22 at 19:30
  • Adding more information - the styling that went away was for an "Exposed Filter" search box "Apply" and "Reset" button. – Apurva Pathak Oct 24 at 15:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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