You are here

public function Importer::import in Feeds Paragraphs 8

File

src/Importer.php, line 89

Class

Importer

Namespace

Drupal\feeds_para_mapper

Code

public function import(FeedTypeInterface $feedType, FeedInterface $feed, EntityInterface $entity, FieldConfigInterface $target, array $configuration, array $values, FieldTargetBase $instance) {
  $this->feed = $feed;
  $this->entity = $entity;
  $this->target = $target;
  $this->configuration = $configuration;
  $this->values = $values;
  $this->targetInfo = $target
    ->get('target_info');
  $this->instance = $instance;

  //@todo: remove explode()

  // @todo: handle taking a value from $values and adding it to a different bundle field

  //$this->explode();
  $this
    ->resetTypes($feedType
    ->getMappingTargets());
  $paragraphs = $this
    ->initHostParagraphs();
  foreach ($paragraphs as $paragraph) {
    $attached = $this
      ->getTarget($paragraph['paragraph'], $this->target);
    $this
      ->setValue($attached[0], $paragraph['value']);
    if (!$this->entity
      ->isNew()) {
      $this
        ->appendToUpdate($attached[0]);
    }
  }
}