You are here

public function MediaSourceBase::__construct in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/media/src/MediaSourceBase.php \Drupal\media\MediaSourceBase::__construct()

Constructs a new class instance.

Parameters

array $configuration: A configuration array containing information about the plugin instance.

string $plugin_id: The plugin_id for the plugin instance.

mixed $plugin_definition: The plugin implementation definition.

\Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager: Entity type manager service.

\Drupal\Core\Entity\EntityFieldManagerInterface $entity_field_manager: Entity field manager service.

\Drupal\Core\Field\FieldTypePluginManagerInterface $field_type_manager: The field type plugin manager service.

\Drupal\Core\Config\ConfigFactoryInterface $config_factory: The config factory service.

Overrides PluginBase::__construct

2 calls to MediaSourceBase::__construct()
Image::__construct in core/modules/media/src/Plugin/media/Source/Image.php
Constructs a new class instance.
OEmbed::__construct in core/modules/media/src/Plugin/media/Source/OEmbed.php
Constructs a new OEmbed instance.
2 methods override MediaSourceBase::__construct()
Image::__construct in core/modules/media/src/Plugin/media/Source/Image.php
Constructs a new class instance.
OEmbed::__construct in core/modules/media/src/Plugin/media/Source/OEmbed.php
Constructs a new OEmbed instance.

File

core/modules/media/src/MediaSourceBase.php, line 75

Class

MediaSourceBase
Base implementation of media source plugin.

Namespace

Drupal\media

Code

public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager, EntityFieldManagerInterface $entity_field_manager, FieldTypePluginManagerInterface $field_type_manager, ConfigFactoryInterface $config_factory) {
  parent::__construct($configuration, $plugin_id, $plugin_definition);
  $this->entityTypeManager = $entity_type_manager;
  $this->entityFieldManager = $entity_field_manager;
  $this->fieldTypeManager = $field_type_manager;
  $this->configFactory = $config_factory;

  // Add the default configuration of the media source to the plugin.
  $this
    ->setConfiguration($configuration);
}