How do I get the host paragraph when a paragraph is referenced in another paragraph? I have referenced Paragraph B in Paragraph A and in preprocess of Paragraph B I want to access host paragraph A. Is this possible with ease. As in case of paragraph references on node we can do paragraph-&gt;getParentEntity() ?
 I had tried same but it still get the parent node :(
If you look at the Paragraph class in the module, you will find a public method called getParentEntity that return the parent entity of a Paragraph instance.

So, if you do:

$parent = $paragraph-&gt;getParentEntity();

if (isset($parent)) {
  // Your stuff ...
}


You would have the parent entity in the $parent variable. You can chain the method if there is multiple nested paragraphs. I also suggest using the isset method on the $parent variable because I've encounter some weird issues where random paragraphs returns null.