public function ParagraphLineageInspector::getRootParent in Paragraphs Edit 8.2
Gets the root parent of this paragraph.
Parameters
\Drupal\paragraphs\ParagraphInterface $paragraph: Paragraph data.
Return value
\Drupal\Core\Entity\ContentEntityInterface|null Root parent.
File
- src/
ParagraphLineageInspector.php, line 22
Class
- ParagraphLineageInspector
- ParagraphLineageInspector class.
Namespace
Drupal\paragraphs_editCode
public function getRootParent(ParagraphInterface $paragraph) {
$root_parent = $paragraph
->getParentEntity();
while ($root_parent instanceof ParagraphInterface) {
$root_parent = $root_parent
->getParentEntity();
}
return $root_parent;
}