I have two content types – A and B. For content type A, there are 5 content items – Aa, Ab, Ac, Ad, Ae. For content type B, I have two items Ba, Bb. Content type B has a field that is an entity reference of content type A. In a single page I have the following setup:
Ba -> Aa, Ab, Ac, Ad, Ae
Bb -> Aa, Ab, Ac, Ad, Ae
I have a twig template for B and a separate one for A. When rendering Aa – Ae, I need to know if the container node is Ba or Bb because it is rendered differently. Ba and Bb know about the referenced entities (Aa – Ae), but the referenced entities don’t know who their parent is.
I’ve tried using the preprocessor but I can’t seem to find a way to get the parent (containter) node.
Any suggestions?
TIA.