You are here

public function ProviderManager::loadProviderFromStream in Video 8

Same name and namespace in other branches
  1. 8.2 src/ProviderManager.php \Drupal\video\ProviderManager::loadProviderFromStream()

Load a provider from stream wrapper.

Parameters

string $stream: Stream used from the file.

Drupal\file\Entity\File $file: The source file.

array $data: Source file metadata.

Return value

\Drupal\video\ProviderPluginInterface|bool The loaded plugin.

Overrides ProviderManagerInterface::loadProviderFromStream

File

src/ProviderManager.php, line 69

Class

ProviderManager
Gathers the provider plugins.

Namespace

Drupal\video

Code

public function loadProviderFromStream($stream, $file, $metadata = [], $settings = []) {
  $definitions = $this
    ->getDefinitions();
  foreach ($definitions as $definition) {
    if ($definition['stream_wrapper'] == $stream) {
      return $definition ? $this
        ->createInstance($definition['id'], [
        'file' => $file,
        'metadata' => $metadata,
        'settings' => $settings,
      ]) : FALSE;
    }
  }
}