You are here

private function Importer::createParagraph in Feeds Paragraphs 8

Creates and attaches a Paragraphs entity to another entity.

Parameters

string $field: The host field.

string $bundle: The host bundle.

ContentEntityInterface $host_entity: The host entity.

Return value

Paragraph The created Paragraphs entity

2 calls to Importer::createParagraph()
Importer::createParents in src/Importer.php
Creates a paragraph entity and its parents entities.
Importer::duplicateExisting in src/Importer.php
Duplicates an existing paragraph entity.

File

src/Importer.php, line 576

Class

Importer

Namespace

Drupal\feeds_para_mapper

Code

private function createParagraph($field, $bundle, $host_entity) {
  $created = $this->paragraph_storage
    ->create(array(
    "type" => $bundle,
  ));
  $host_entity
    ->get($field)
    ->appendItem($created);
  $host_info = array(
    'type' => $host_entity
      ->getEntityTypeId(),
    'entity' => $host_entity,
    'bundle' => $bundle,
    'field' => $field,
  );
  $created->host_info = $host_info;
  return $created;
}