I am trying to create a preprocess function in my .theme file in order to make a variable available to node templates.
I want the variable to contain just the names of all regions that are currently in use (i.e. rendering content).
The idea being, if I have a region called left_hand_nav which is rendered on some (not all) pages, and I have a node called generic_page, from my generic_page node template I’d like to be able to do:
{% if left_hand_nav %}
do something
{% else %}
do something else
{% endif %}
I am not interested in controlling the rendering of any regions blocks from the node template. Instead for any given page wherein the node is rendered I just want to know if a particular region on said page is in use.
I realize this can very easily be done from a page template but instead of having a kazillion billion conditionals in my page template I’d prefer a few conditionals in several node templates.
If someone could point me in the right direction I’d appreciate it very much.