function OEmbed::__construct

Same name and namespace in other branches
  1. 10 core/modules/media/src/Plugin/media/Source/OEmbed.php \Drupal\media\Plugin\media\Source\OEmbed::__construct()
  2. 11.x core/modules/media/src/Plugin/media/Source/OEmbed.php \Drupal\media\Plugin\media\Source\OEmbed::__construct()
  3. 9 core/modules/media/src/Plugin/media/Source/OEmbed.php \Drupal\media\Plugin\media\Source\OEmbed::__construct()
  4. 8.9.x 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 $httpClient: The HTTP client.

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

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

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

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

\Drupal\Core\Utility\Token $token: The token replacement service.

\Drupal\Core\Image\ImageFactory|null $image_factory: The image factory service.

Overrides MediaSourceBase::__construct

File

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

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, protected LoggerInterface $logger, MessengerInterface $messenger, protected ClientInterface $httpClient, protected ResourceFetcherInterface $resourceFetcher, protected UrlResolverInterface $urlResolver, protected IFrameUrlHelper $iFrameUrlHelper, protected FileSystemInterface $fileSystem, protected Token $token, ?ImageFactory $image_factory = NULL) {
  parent::__construct($configuration, $plugin_id, $plugin_definition, $entity_type_manager, $entity_field_manager, $field_type_manager, $config_factory);
  $this->messenger = $messenger;
  if (!$image_factory) {
    @trigger_error('Calling ' . __CLASS__ . '::__construct() without the $image_factory argument is deprecated in drupal:11.4.0 and the $image_factory argument will be required in drupal:12.0.0. See https://www.drupal.org/node/9999999', E_USER_DEPRECATED);
    $image_factory = \Drupal::service('image.factory');
  }
  $this->imageFactory = $image_factory;
}

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