public function ProviderRepository::setProvider in Drupal 8
Same name and namespace in other branches
- 9 core/modules/media/tests/modules/media_test_oembed/src/ProviderRepository.php \Drupal\media_test_oembed\ProviderRepository::setProvider()
- 10 core/modules/media/tests/modules/media_test_oembed/src/ProviderRepository.php \Drupal\media_test_oembed\ProviderRepository::setProvider()
Stores an oEmbed provider value object in state.
Parameters
\Drupal\media\OEmbed\Provider $provider: The provider to store.
File
- core/
modules/ media/ tests/ modules/ media_test_oembed/ src/ ProviderRepository.php, line 48
Class
- ProviderRepository
- Overrides the oEmbed provider repository service for testing purposes.
Namespace
Drupal\media_test_oembedCode
public function setProvider(Provider $provider) {
$providers = \Drupal::state()
->get(static::class, []);
$name = $provider
->getName();
$providers[$name] = $provider;
\Drupal::state()
->set(static::class, $providers);
}