I'm using Drupal 8 Views with Better Exposed Filters to filter a custom content type by two custom taxonomy vocabularies.

Results are filtered by:

  • Content: Published (=Yes),
  • Content: Content type (in Custom-Type),
  • Content: Taxonomy Vocabulary1 (exposed),
  • Content: Taxonomy Vocabulary2 (exposed),

The filters are working as desired, and the "No results behavior" generates a label on the results (technically, it's a Global: Text area, not a label) that says:

No results found

When there are results, the client requires a similarly-formatted label on the results that will say something like this:

Viewing 12 of 42 results for: [Vocabulary1 Term] with [Vocabulary2 Term]

Can I accomplish this with Views UI, or should I handle it in the Twig template? Theme suggestions say that the Twig template in use is field--paragraph--field-views--views-reference.html.twig.

NOTE: As a pager, I'm using Infinite Scroll to reveal 12 new results at a time. At the bottom of each screen full of results, there's a button that says:

Load More [Custom-Type]s

Infinite Scroll options are very similar to what I want:

The following tokens are supported:

@next_page_count -- the next page record count

@total -- the total amount of results returned from the view

Instead of showing the @next_page_count, I really need the current page count (which will increment by 12 results each time the button is pressed, and by the remainder for the last screenful.) And instead of rendering this text on the button, the client wants it back at the top of the results.

1 Answer 1


Your question doesn't seem to be related to Better Exposed Filters, BEF only format the actual form elements of the exposed form, not the display of the view results.

You can use the Result summary option you can add to the Header or Footer area in Views. It's under the Global Category, here are the listed tokens:

You may use HTML code in this field. The following tokens are supported:

@start -- the initial record number in the set
@end -- the last record number in the set
@total -- the total records in the set
@label -- the human-readable name of the view
@per_page -- the number of items per page
@current_page -- the current page number
@current_record_count -- the current page record count
@page_count -- the total page count

You can also use the Text area option that comes with some more options, including the arguments from Contextual and Exposed filters (if you turn on the Use replacement tokens from the first row):


[view:base-field] - Base field: The base field used for this view.
[view:base-table] - Base table: The base table used for this view.
[view:current-page] - Current page: The current page of results the view is on.
[view:description] - Description: The description of the view.
[view:id] - ID: The machine-readable ID of the view.
[view:items-per-page] - Items per page: The number of items per page.
[view:label] - Label: The label of the view.
[view:page-count] - Page count: The total page count.
[view:title] - Title: The title of current display of the view.
[view:total-rows] - Total rows: The total amount of results returned from the view. The current display will be used.
[view:url] - URL: The URL of the view.

In your case you're filtering by Taxonomy Entity Reference field (that information is directly in the node). But the ER fields only store the ID number of the referenced entity (TID in your case) and not anything else, which mean the Taxonomy term name isn't saved inside the node.

There is some magic done in Views for Taxonomy that makes it seem like the term data is available but those are targeted specific parts. Generally speaking you have to add a Relationship for that ER field in order to pull in data about the referenced entities.

So in you case you need to add the Relatinship for the Color and Size (how ever you have them called), and then add the Taxonomy: Name field for both cases.

Now when you open the Use replacement tokens from the first row option you will see the tokens for those fields that show term Names more directly, something like {{ name_1 }} == Taxonomy term: Name.

You will probably want to use some twig logic when to show it, check for Exposed filter being used.

  • Thanks for a good start. What about the taxonomy terms? (i.e., if the vocabularies were color and size, then the label should say "Viewing @per_page of @total for: red with small ") Commented Oct 16, 2019 at 12:39
  • 1
    As I mentioned you get the Exposed filters values by turning on the option Use replacement tokens from the first row in the Text area. I'll add to the answer.
    – prkos
    Commented Oct 16, 2019 at 13:01

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.