You are here

class OEmbedResourceUrlAlterEvent in Hook Event Dispatcher 3.x

Same name and namespace in other branches
  1. 8.2 modules/media_event_dispatcher/src/Event/Media/OEmbedResourceUrlAlterEvent.php \Drupal\media_event_dispatcher\Event\Media\OEmbedResourceUrlAlterEvent

Class OEmbedResourceUrlAlterEvent.

Hierarchy

Expanded class hierarchy of OEmbedResourceUrlAlterEvent

2 files declare their use of OEmbedResourceUrlAlterEvent
media_event_dispatcher.module in modules/media_event_dispatcher/media_event_dispatcher.module
Media event dispatcher submodule.
OEmbedResourceUrlAlterEventTest.php in modules/media_event_dispatcher/tests/src/Unit/Media/OEmbedResourceUrlAlterEventTest.php

File

modules/media_event_dispatcher/src/Event/Media/OEmbedResourceUrlAlterEvent.php, line 13

Namespace

Drupal\media_event_dispatcher\Event\Media
View source
class OEmbedResourceUrlAlterEvent extends Event implements EventInterface {

  /**
   * The oEmbed URL that data will be retrieved from.
   *
   * Note that this is an array as returned by
   * \Drupal\Component\Utility\UrlHelper::parse().
   *
   * @var array
   */
  private $parsedUrl;

  /**
   * The oEmbed provider for the resource to be retrieved.
   *
   * @var \Drupal\media\OEmbed\Provider
   */
  private $provider;

  /**
   * OEmbedResourceUrlAlterEvent constructor.
   *
   * @param array &$parsedUrl
   *   The oEmbed URL that data will be retrieved from, parsed into an array by
   *   \Drupal\Component\Utility\UrlHelper::parse().
   * @param \Drupal\media\OEmbed\Provider $provider
   *   The oEmbed provider for the resource to be retrieved.
   */
  public function __construct(array &$parsedUrl, Provider $provider) {
    $this->parsedUrl =& $parsedUrl;
    $this->provider = $provider;
  }

  /**
   * Get the URL that the oEmbed data will be retrieved from.
   *
   * Note that this is an array as returned by
   * \Drupal\Component\Utility\UrlHelper::parse().
   *
   * @return array
   *   The parsed URL for this oEmbed resource.
   */
  public function &getParsedUrl() : array {
    return $this->parsedUrl;
  }

  /**
   * Get the oEmbed provider for the resource to be retrieved.
   *
   * @return \Drupal\media\OEmbed\Provider
   *   The oEmbed provider for the resource.
   */
  public function getProvider() : Provider {
    return $this->provider;
  }

  /**
   * {@inheritdoc}
   */
  public function getDispatcherType() : string {
    return HookEventDispatcherInterface::MEDIA_OEMBED_RESOURCE_DATA_ALTER;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
OEmbedResourceUrlAlterEvent::$parsedUrl private property The oEmbed URL that data will be retrieved from.
OEmbedResourceUrlAlterEvent::$provider private property The oEmbed provider for the resource to be retrieved.
OEmbedResourceUrlAlterEvent::getDispatcherType public function Get the dispatcher type. Overrides EventInterface::getDispatcherType
OEmbedResourceUrlAlterEvent::getParsedUrl public function Get the URL that the oEmbed data will be retrieved from.
OEmbedResourceUrlAlterEvent::getProvider public function Get the oEmbed provider for the resource to be retrieved.
OEmbedResourceUrlAlterEvent::__construct public function OEmbedResourceUrlAlterEvent constructor.