You are here

public function MediaTarget::__construct in Media Feeds 8

Constructs a new EntityReference object.

Parameters

array $configuration: The plugin configuration.

string $plugin_id: The plugin id.

array $plugin_definition: The plugin definition.

\Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager: The entity type manager.

\Drupal\Core\Entity\EntityFieldManagerInterface $entity_field_manager: The entity field manager.

\Drupal\feeds\EntityFinderInterface $entity_finder: The Feeds entity finder service.

Overrides EntityReference::__construct

File

src/Feeds/Target/MediaTarget.php, line 92

Class

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

Namespace

Drupal\media_feeds\Feeds\Target

Code

public function __construct(array $configuration, $plugin_id, array $plugin_definition, MessengerInterface $messenger, FeedsPluginManager $plugin_manager, EntityFieldManagerInterface $entityFieldManager, EntityTypeManagerInterface $entity_type_manager, EntityRepositoryInterface $entity_repository, QueryFactory $query_factory) {
  $this->messenger = $messenger;
  $this->plugin_manager = $plugin_manager;
  $this->entityFieldManager = $entityFieldManager;
  $this->entityTypeManager = $entity_type_manager;
  $this->media_storage = $entity_type_manager
    ->getStorage('media');
  $this->configuration = $configuration;
  $this->targetDefinition = $configuration['target_definition'];
  $this->field = $this->targetDefinition
    ->getFieldDefinition();
  if (self::isMedia($this->field)) {
    $this->isMedia = true;
    $this->targetInstance = $this
      ->createTargetInstance();
    FieldTargetBase::__construct($configuration, $plugin_id, $plugin_definition);
  }
  else {
    $this->isMedia = false;
    parent::__construct($configuration, $plugin_id, $plugin_definition, $entity_type_manager, $query_factory, $entityFieldManager, $entity_repository);
  }
}