You are here

public function ParagraphDeleteForm::getParentField in Paragraphs table 8

Gets the field the paragraph is referenced from.

Parameters

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

Return value

\Drupal\entity_reference_revisions\EntityReferenceRevisionsFieldItemList|null Parent field.

1 call to ParagraphDeleteForm::getParentField()
ParagraphDeleteForm::submitForm in src/Form/ParagraphDeleteForm.php
This is the default entity object builder function. It is called before any other submit handler to build the new entity object to be used by the following submit handlers. At this point of the form workflow the entity is validated and the form state…

File

src/Form/ParagraphDeleteForm.php, line 76

Class

ParagraphDeleteForm
Provides a form for deleting a paragraph from a node.

Namespace

Drupal\paragraphs_table\Form

Code

public function getParentField(ParagraphInterface $paragraph) {
  $parent = $paragraph
    ->getParentEntity();
  if (!$parent) {
    return NULL;
  }
  return $parent
    ->get($paragraph
    ->get('parent_field_name')->value);
}