public function ProviderPluginBase::__construct in Video Embed Field 8
Same name and namespace in other branches
- 8.2 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_fieldCode
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;
}