protected function GeysirModalParagraphAddForm::insertFirstItem in Geysir 8
Insert the first paragraph for the node.
1 call to GeysirModalParagraphAddForm::insertFirstItem()
- GeysirModalParagraphAddForm::save in src/
Form/ GeysirModalParagraphAddForm.php - Form submission handler for the 'save' action.
File
- src/
Form/ GeysirModalParagraphAddForm.php, line 105
Class
- GeysirModalParagraphAddForm
- Functionality to edit a paragraph through a modal.
Namespace
Drupal\geysir\FormCode
protected function insertFirstItem($parent_entity) {
$route_match = $this
->getRouteMatch();
$field = $route_match
->getParameter('field');
$value = [
'target_id' => $this->entity
->id(),
'target_revision_id' => $this->entity
->getRevisionId(),
];
$parent_entity
->get($field)
->appendItem($value);
}