public function LayoutParagraphsLayout::appendComponent in Layout Paragraphs 2.0.x
Append a new component.
Parameters
\Drupal\paragraphs\Entity\Paragraph $new_paragraph: The paragraph component to append.
Return value
$this
File
- src/
LayoutParagraphsLayout.php, line 450
Class
- LayoutParagraphsLayout
- Provides a domain object for a complete Layout Paragraphs Layout.
Namespace
Drupal\layout_paragraphsCode
public function appendComponent(Paragraph $new_paragraph) {
$this->paragraphsReferenceField
->appendItem([
'entity' => $new_paragraph,
]);
return $this;
}