function hook_oembed_providers_alter in oEmbed Providers 2.x
Same name and namespace in other branches
- 1.1.x oembed_providers.api.php \hook_oembed_providers_alter()
Alters the list of providers after it is fetched.
The provider list is a pre-cache array of oEmbed providers. This hook fires before \Drupal\media\OEmbed\Provider objects are generated from the provider list.
Parameters
array $providers: An array of provider definitions, as fetched from the oEmbed providers URL.
See also
\Drupal\oembed_providers\OEmbed\ProviderRepositoryDecorator::getAll()
1 function implements hook_oembed_providers_alter()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- oembed_providers_test_oembed_providers_alter in tests/
modules/ oembed_providers_test/ oembed_providers_test.module - Implements hook_oembed_providers_alter().
1 invocation of hook_oembed_providers_alter()
- ProviderRepositoryDecorator::getAll in src/
OEmbed/ ProviderRepositoryDecorator.php - Returns information on all available oEmbed providers.
File
- ./
oembed_providers.api.php, line 20 - Hooks related to the oEmbed Providers module.
Code
function hook_oembed_providers_alter(array &$providers) {
// Add a custom provider.
$providers[] = [
'provider_name' => 'Custom Provider',
'provider_url' => 'http://custom-provider.example.com',
'endpoints' => [
[
'schemes' => [
'http://custom-provider.example.com/id/*',
'https://custom-provider.example.com/id/*',
],
'url' => 'https://custom-provider.example.com/api/v2/oembed/',
'discovery' => 'true',
],
],
];
}