You are here

public function ProviderRepository::get in Drupal 8

Same name in this branch
  1. 8 core/modules/media/src/OEmbed/ProviderRepository.php \Drupal\media\OEmbed\ProviderRepository::get()
  2. 8 core/modules/media/tests/modules/media_test_oembed/src/ProviderRepository.php \Drupal\media_test_oembed\ProviderRepository::get()
Same name and namespace in other branches
  1. 9 core/modules/media/tests/modules/media_test_oembed/src/ProviderRepository.php \Drupal\media_test_oembed\ProviderRepository::get()

Returns information for a specific oEmbed provider.

Parameters

string $provider_name: The name of the provider.

Return value

\Drupal\media\OEmbed\Provider A value object containing information about the provider.

Throws

\InvalidArgumentException If there is no known oEmbed provider with the specified name.

Overrides ProviderRepository::get

File

core/modules/media/tests/modules/media_test_oembed/src/ProviderRepository.php, line 33

Class

ProviderRepository
Overrides the oEmbed provider repository service for testing purposes.

Namespace

Drupal\media_test_oembed

Code

public function get($provider_name) {
  $providers = \Drupal::state()
    ->get(static::class, []);
  if (isset($providers[$provider_name])) {
    return $providers[$provider_name];
  }
  return parent::get($provider_name);
}