You are here

public function WrapperTarget::createTargetInstance in Feeds Paragraphs 8

1 call to WrapperTarget::createTargetInstance()
WrapperTarget::__construct in src/Feeds/Target/WrapperTarget.php
Constructs a TargetBase object.

File

src/Feeds/Target/WrapperTarget.php, line 116

Class

WrapperTarget
Defines a wrapper target around a paragraph bundle's target field.

Namespace

Drupal\feeds_para_mapper\Feeds\Target

Code

public function createTargetInstance() {
  $mapper = $this
    ->getMapper();
  $plugin = $mapper
    ->getInfo($this->field, 'plugin');
  $class = $plugin['class'];
  $target = $class::prepareTarget($this->field);
  if (!isset($target)) {
    return null;
  }
  $target
    ->setPluginId($plugin['id']);
  $instance = null;
  try {
    $instance = $this->plugin_manager
      ->createInstance($plugin['id'], $this->configuration);
  } catch (PluginException $e) {
  }
  return $instance;
}