public function Paragraph::setParentEntity in Paragraphs 8
Set the parent entity of the paragraph.
Parameters
\Drupal\Core\Entity\ContentEntityInterface $parent: The parent entity.
string $parent_field_name: The parent field name.
Return value
$this
Overrides ParagraphInterface::setParentEntity
File
- src/
Entity/ Paragraph.php, line 141
Class
- Paragraph
- Defines the Paragraph entity.
Namespace
Drupal\paragraphs\EntityCode
public function setParentEntity(ContentEntityInterface $parent, $parent_field_name) {
$this
->set('parent_type', $parent
->getEntityTypeId());
$this
->set('parent_id', $parent
->id());
$this
->set('parent_field_name', $parent_field_name);
return $this;
}