You are here

interface UrlResolverInterface in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/media/src/OEmbed/UrlResolverInterface.php \Drupal\media\OEmbed\UrlResolverInterface
  2. 9 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

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

... See full list

File

core/modules/media/src/OEmbed/UrlResolverInterface.php, line 12

Namespace

Drupal\media\OEmbed
View 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

Namesort descending Modifiers Type Description Overrides
UrlResolverInterface::getProviderByUrl public function Tries to determine the oEmbed provider for a media asset URL. 1
UrlResolverInterface::getResourceUrl public function Builds the resource URL for a media asset URL. 1