function MediaSourceBase::__construct

Same name in other branches
  1. 9 core/modules/media/src/MediaSourceBase.php \Drupal\media\MediaSourceBase::__construct()
  2. 8.9.x core/modules/media/src/MediaSourceBase.php \Drupal\media\MediaSourceBase::__construct()
  3. 11.x 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.

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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.