You are here

ExternalHreflangGetCurrentUrlEvent.php in External Hreflang 8

File

src/Event/ExternalHreflangGetCurrentUrlEvent.php
View source
<?php

namespace Drupal\external_hreflang\Event;

use Drupal\Core\Url;
use Symfony\Component\EventDispatcher\Event;

/**
 * Class to get Current Url.
 *
 * @package Drupal\external_hreflang\Event
 */
class ExternalHreflangGetCurrentUrlEvent extends Event {
  const EVENT_NAME = 'external_hreflang_get_current_url';

  /**
   * Url object.
   *
   * @var \Drupal\Core\Url
   */
  private $url;

  /**
   * Get the current url object.
   *
   * @return \Drupal\Core\Url
   *   URL object.
   */
  public function getCurrentUrl() {
    return $this->url;
  }

  /**
   * Set the current url object.
   *
   * @param \Drupal\Core\Url $url
   *   URL object.
   */
  public function setCurrentUrl(Url $url) {
    $url
      ->setAbsolute(FALSE);
    $this->url = $url;
  }

}

Classes

Namesort descending Description
ExternalHreflangGetCurrentUrlEvent Class to get Current Url.