You are here

public function ProviderPluginBase::__construct in Video Embed Field 8.2

Same name and namespace in other branches
  1. 8 src/ProviderPluginBase.php \Drupal\video_embed_field\ProviderPluginBase::__construct()

Create a plugin with the given input.

Parameters

array $configuration: The configuration of the plugin.

string $plugin_id: The plugin id.

array $plugin_definition: The plugin definition.

\GuzzleHttp\ClientInterface $http_client: An HTTP client.

Throws

\Exception

Overrides PluginBase::__construct

File

src/ProviderPluginBase.php, line 63

Class

ProviderPluginBase
A base for the provider plugins.

Namespace

Drupal\video_embed_field

Code

public function __construct($configuration, $plugin_id, $plugin_definition, ClientInterface $http_client) {
  parent::__construct($configuration, $plugin_id, $plugin_definition);
  if (!static::isApplicable($configuration['input'])) {
    throw new \Exception('Tried to create a video provider plugin with invalid input.');
  }
  $this->input = $configuration['input'];
  $this->videoId = $this
    ->getIdFromInput($configuration['input']);
  $this->httpClient = $http_client;
}