You are here

public function ParagraphLineageInspector::getParentFieldItem in Paragraphs Edit 8.2

Gets the field item the paragraph is referenced from.

Parameters

\Drupal\paragraphs\ParagraphInterface $paragraph: Paragraph data.

\Drupal\entity_reference_revisions\EntityReferenceRevisionsFieldItemList|null $parent_field: Parent field.

Return value

\Drupal\entity_reference_revisions\Plugin\Field\FieldType\EntityReferenceRevisionsItem|null Field item.

1 call to ParagraphLineageInspector::getParentFieldItem()
ParagraphLineageInspector::getLineageString in src/ParagraphLineageInspector.php
Builds a string representation of a paragraph's lineage.

File

src/ParagraphLineageInspector.php, line 60

Class

ParagraphLineageInspector
ParagraphLineageInspector class.

Namespace

Drupal\paragraphs_edit

Code

public function getParentFieldItem(ParagraphInterface $paragraph, EntityReferenceRevisionsFieldItemList $parent_field = NULL) {
  if (!$parent_field) {
    $parent_field = $this
      ->getParentField($paragraph);
  }
  return $this
    ->findParentFieldItem($paragraph, $parent_field);
}