class Provider
Same name in other branches
- 9 core/modules/media/src/OEmbed/Provider.php \Drupal\media\OEmbed\Provider
- 8.9.x core/modules/media/src/OEmbed/Provider.php \Drupal\media\OEmbed\Provider
- 11.x core/modules/media/src/OEmbed/Provider.php \Drupal\media\OEmbed\Provider
Value object for oEmbed providers.
Hierarchy
- class \Drupal\media\OEmbed\Provider
Expanded class hierarchy of Provider
5 files declare their use of Provider
- media_test_oembed.module in core/
modules/ media/ tests/ modules/ media_test_oembed/ media_test_oembed.module - Helper module for the Media oEmbed tests.
- OEmbedIframeControllerTest.php in core/
modules/ media/ tests/ src/ Kernel/ OEmbedIframeControllerTest.php - OEmbedResourceConstraintValidatorTest.php in core/
modules/ media/ tests/ src/ Kernel/ OEmbedResourceConstraintValidatorTest.php - OEmbedTestTrait.php in core/
modules/ media/ tests/ src/ Traits/ OEmbedTestTrait.php - ProviderRepository.php in core/
modules/ media/ tests/ modules/ media_test_oembed/ src/ ProviderRepository.php
16 string references to 'Provider'
- AttributeBase::get in core/
lib/ Drupal/ Component/ Plugin/ Attribute/ AttributeBase.php - Gets the value of an attribute.
- block.schema.yml in core/
modules/ block/ config/ schema/ block.schema.yml - core/modules/block/config/schema/block.schema.yml
- BlockPluginTrait::submitConfigurationForm in core/
lib/ Drupal/ Core/ Block/ BlockPluginTrait.php - Most block plugins should not override this method. To add submission handling for a specific block type, override BlockBase::blockSubmit().
- core.data_types.schema.yml in core/
config/ schema/ core.data_types.schema.yml - core/config/schema/core.data_types.schema.yml
- EntityResourceRestTestCoverageTest::testEntityTypeRestTestCoverage in core/
modules/ rest/ tests/ src/ Kernel/ EntityResource/ EntityResourceRestTestCoverageTest.php - Tests that all core content/config entity types have REST test coverage.
File
-
core/
modules/ media/ src/ OEmbed/ Provider.php, line 10
Namespace
Drupal\media\OEmbedView source
class Provider {
/**
* The provider name.
*
* @var string
*/
protected $name;
/**
* The provider URL.
*
* @var string
*/
protected $url;
/**
* The provider endpoints.
*
* @var \Drupal\media\OEmbed\Endpoint[]
*/
protected $endpoints = [];
/**
* Provider constructor.
*
* @param string $name
* The provider name.
* @param string $url
* The provider URL.
* @param array[] $endpoints
* List of endpoints this provider exposes.
*
* @throws \Drupal\media\OEmbed\ProviderException
*/
public function __construct($name, $url, array $endpoints) {
$this->name = $name;
if (!UrlHelper::isValid($url, TRUE) || !UrlHelper::isExternal($url)) {
throw new ProviderException('Provider @name does not define a valid external URL.', $this);
}
$this->url = $url;
try {
foreach ($endpoints as $endpoint) {
$endpoint += [
'formats' => [],
'schemes' => [],
'discovery' => FALSE,
];
$this->endpoints[] = new Endpoint($endpoint['url'], $this, $endpoint['schemes'], $endpoint['formats'], $endpoint['discovery']);
}
} catch (\InvalidArgumentException $e) {
// Just skip all the invalid endpoints.
// @todo Log the exception message to help with debugging in
// https://www.drupal.org/project/drupal/issues/2972846.
}
if (empty($this->endpoints)) {
throw new ProviderException('Provider @name does not define any valid endpoints.', $this);
}
}
/**
* Returns the provider name.
*
* @return string
* Name of the provider.
*/
public function getName() {
return $this->name;
}
/**
* Returns the provider URL.
*
* @return string
* URL of the provider.
*/
public function getUrl() {
return $this->url;
}
/**
* Returns the provider endpoints.
*
* @return \Drupal\media\OEmbed\Endpoint[]
* List of endpoints this provider exposes.
*/
public function getEndpoints() {
return $this->endpoints;
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
Provider::$endpoints | protected | property | The provider endpoints. |
Provider::$name | protected | property | The provider name. |
Provider::$url | protected | property | The provider URL. |
Provider::getEndpoints | public | function | Returns the provider endpoints. |
Provider::getName | public | function | Returns the provider name. |
Provider::getUrl | public | function | Returns the provider URL. |
Provider::__construct | public | function | Provider constructor. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.