interface UrlResolverInterface in Drupal 9
Same name and namespace in other branches
- 8 core/modules/media/src/OEmbed/UrlResolverInterface.php \Drupal\media\OEmbed\UrlResolverInterface
Defines the interface for the oEmbed URL resolver service.
The URL resolver is responsible for converting oEmbed-compatible media asset URLs into canonical resource URLs, at which an oEmbed representation of the asset can be retrieved.
Hierarchy
- interface \Drupal\media\OEmbed\UrlResolverInterface
Expanded class hierarchy of UrlResolverInterface
All classes that implement UrlResolverInterface
7 files declare their use of UrlResolverInterface
- OEmbed.php in core/
modules/ media/ src/ Plugin/ media/ Source/ OEmbed.php - OEmbedForm.php in core/
modules/ media_library/ src/ Form/ OEmbedForm.php - OEmbedFormatter.php in core/
modules/ media/ src/ Plugin/ Field/ FieldFormatter/ OEmbedFormatter.php - OEmbedIframeController.php in core/
modules/ media/ src/ Controller/ OEmbedIframeController.php - OEmbedResourceConstraintValidator.php in core/
modules/ media/ src/ Plugin/ Validation/ Constraint/ OEmbedResourceConstraintValidator.php
File
- core/
modules/ media/ src/ OEmbed/ UrlResolverInterface.php, line 12
Namespace
Drupal\media\OEmbedView source
interface UrlResolverInterface {
/**
* Tries to determine the oEmbed provider for a media asset URL.
*
* @param string $url
* The media asset URL.
*
* @return \Drupal\media\OEmbed\Provider
* The oEmbed provider for the asset.
*
* @throws \Drupal\media\OEmbed\ResourceException
* If the provider cannot be determined.
* @throws \Drupal\media\OEmbed\ProviderException
* If tne oEmbed provider causes an error.
*/
public function getProviderByUrl($url);
/**
* Builds the resource URL for a media asset URL.
*
* @param string $url
* The media asset URL.
* @param int $max_width
* (optional) Maximum width of the oEmbed resource, in pixels.
* @param int $max_height
* (optional) Maximum height of the oEmbed resource, in pixels.
*
* @return string
* Returns the resource URL corresponding to the given media item URL.
*/
public function getResourceUrl($url, $max_width = NULL, $max_height = NULL);
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
UrlResolverInterface:: |
public | function | Tries to determine the oEmbed provider for a media asset URL. | 1 |
UrlResolverInterface:: |
public | function | Builds the resource URL for a media asset URL. | 1 |