4

I have the following setup:

  1. Block view
  2. Contextual filter: Author UID -> Provide default value -> User ID from logged in user.
  3. Fields: various
  4. Filters: various
  5. No results behaviour: text

I want the user to see a list of nodes that they have created. If no nodes are found, I want the No results text to show. Currently, it's all working fine if nodes are found. However, if no results are found, the entire view is hidden. Is this standard behaviour? How do I make it display the No results text?

0

2 Answers 2

7

I just had a similar issue, I had a block view showing the current category:

  1. Block view
  2. Contextual Filter - Taxonomy term: Term ID - Provide default value (term id from url)
  3. fields
  4. filters
  5. No results - Global text field

Like you, because the contextual filter was set to provide default value I never saw the no results text.

SOLUTION

Edit the contextual filter and scroll down to the bottom, under

"When the filter value IS available or a default is provided"

  1. Check Specify validation criteria.
  2. Leave validator as default.
  3. Change "Action to take if filter value does not validate" to "display contents of No result found".

Bingo, on the Overview page with no term passed I get the no results found text, and when I go to a category page it picks up the term and displays the correct content.

0

Ok, my bad here. I was using a template override and had removed the line printing $empty. Which would explain why it was showing up in the preview, but not in the rendered block.

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.