I want to display a block on each page (nodes as well as pages created by Views) that displays links to nodes that are tagged with a certain taxonomy term.
How to decide which tag should be used:
- {1} If the page is a node that references a taxonomy term:
use the referenced term - {2} If the page is a node that doesn’t reference a taxonomy term (= empty value):
use the term with ID 1 - {3} If the page is not a node (= created by Views):
use the term with ID 1
I managed to get the links shown in case {1}, by using the relationship “Content: Taxonomy terms on node” and the contextual filter “Taxonomy term: Term ID” which uses the relationship.
I selected “Provide a default value” (Type: “Taxonomy term ID from URL” + “Load default filter from node page, that’s good for related taxonomy blocks”). So I can’t specify the default value here for case {2} and {3}.
Then I thought I could use the validation options somehow, but “Action to take if filter value does not validate” does not allow me to set a specific value in case the original default value does not exist.
How could I solve this?
tl;dr: I need something like: Take term ID from URL (via node ID), and if this gives no term ID, use term ID 1 instead.
Sponsored by SupremePR