You are here

interface ResourceFetcherInterface in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/media/src/OEmbed/ResourceFetcherInterface.php \Drupal\media\OEmbed\ResourceFetcherInterface
  2. 9 core/modules/media/src/OEmbed/ResourceFetcherInterface.php \Drupal\media\OEmbed\ResourceFetcherInterface

Defines an interface for an oEmbed resource fetcher service.

The resource fetcher's only responsibility is to retrieve oEmbed resource data from an endpoint URL (i.e., as returned by \Drupal\media\OEmbed\UrlResolverInterface::getResourceUrl()) and return a \Drupal\media\OEmbed\Resource value object.

Hierarchy

Expanded class hierarchy of ResourceFetcherInterface

All classes that implement ResourceFetcherInterface

6 files declare their use of ResourceFetcherInterface
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/ResourceFetcherInterface.php, line 13

Namespace

Drupal\media\OEmbed
View source
interface ResourceFetcherInterface {

  /**
   * Fetches an oEmbed resource.
   *
   * @param string $url
   *   Endpoint-specific URL of the oEmbed resource.
   *
   * @return \Drupal\media\OEmbed\Resource
   *   A resource object built from the oEmbed resource data.
   *
   * @see https://oembed.com/#section2
   *
   * @throws \Drupal\media\OEmbed\ResourceException
   *   If the oEmbed endpoint is not reachable or the response returns an
   *   unexpected Content-Type header.
   */
  public function fetchResource($url);

}

Members

Namesort descending Modifiers Type Description Overrides
ResourceFetcherInterface::fetchResource public function Fetches an oEmbed resource. 1