You are here

function _external_hreflang_get_url_from_request in External Hreflang 8

Get url object for current request.

Allow other modules to provide the url and cache statically for same request.

Return value

\Drupal\Core\Url Url object.

1 call to _external_hreflang_get_url_from_request()
external_hreflang_tokens in ./external_hreflang.tokens.inc
Implements hook_tokens().

File

./external_hreflang.tokens.inc, line 70
Token related functions for the external_hreflang.

Code

function _external_hreflang_get_url_from_request() {
  static $url;
  if (empty($url)) {
    $event = new ExternalHreflangGetCurrentUrlEvent();
    \Drupal::service('event_dispatcher')
      ->dispatch(ExternalHreflangGetCurrentUrlEvent::EVENT_NAME, $event);
    $url = $event
      ->getCurrentUrl();
  }
  return $url;
}