You are here

public function OEmbed::__construct in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/media/src/Plugin/media/Source/OEmbed.php \Drupal\media\Plugin\media\Source\OEmbed::__construct()

Constructs a new OEmbed 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: The entity type manager service.

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

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

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

\Psr\Log\LoggerInterface $logger: The logger channel for media.

\Drupal\Core\Messenger\MessengerInterface $messenger: The messenger service.

\GuzzleHttp\ClientInterface $http_client: The HTTP client.

\Drupal\media\OEmbed\ResourceFetcherInterface $resource_fetcher: The oEmbed resource fetcher service.

\Drupal\media\OEmbed\UrlResolverInterface $url_resolver: The oEmbed URL resolver service.

\Drupal\media\IFrameUrlHelper $iframe_url_helper: The iFrame URL helper service.

\Drupal\Core\File\FileSystemInterface $file_system: The file system.

Overrides MediaSourceBase::__construct

File

core/modules/media/src/Plugin/media/Source/OEmbed.php, line 158

Class

OEmbed
Provides a media source plugin for oEmbed resources.

Namespace

Drupal\media\Plugin\media\Source

Code

public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager, EntityFieldManagerInterface $entity_field_manager, ConfigFactoryInterface $config_factory, FieldTypePluginManagerInterface $field_type_manager, LoggerInterface $logger, MessengerInterface $messenger, ClientInterface $http_client, ResourceFetcherInterface $resource_fetcher, UrlResolverInterface $url_resolver, IFrameUrlHelper $iframe_url_helper, FileSystemInterface $file_system = NULL) {
  parent::__construct($configuration, $plugin_id, $plugin_definition, $entity_type_manager, $entity_field_manager, $field_type_manager, $config_factory);
  $this->logger = $logger;
  $this->messenger = $messenger;
  $this->httpClient = $http_client;
  $this->resourceFetcher = $resource_fetcher;
  $this->urlResolver = $url_resolver;
  $this->iFrameUrlHelper = $iframe_url_helper;
  if (!$file_system) {
    @trigger_error('The file_system service must be passed to OEmbed::__construct(), it is required before Drupal 9.0.0. See https://www.drupal.org/node/3006851.', E_USER_DEPRECATED);
    $file_system = \Drupal::service('file_system');
  }
  $this->fileSystem = $file_system;
}