function Htmx::urlValue

Helper method to get the url string and store cache metadata.

Parameters

\Drupal\Core\Url $url: The URL to generate.

Return value

string The url string.

7 calls to Htmx::urlValue()
Htmx::buildRequestAttribute in core/lib/Drupal/Core/Htmx/Htmx.php
Utility function for the request attributes.
Htmx::locationHeader in core/lib/Drupal/Core/Htmx/Htmx.php
Set HX-Location header.
Htmx::pushUrl in core/lib/Drupal/Core/Htmx/Htmx.php
Creates a `data-hx-push-url` attribute.
Htmx::pushUrlHeader in core/lib/Drupal/Core/Htmx/Htmx.php
Set HX-Push-Url header.
Htmx::redirectHeader in core/lib/Drupal/Core/Htmx/Htmx.php
Set HX-Redirect header.

... See full list

File

core/lib/Drupal/Core/Htmx/Htmx.php, line 142

Class

Htmx
Presents the HTMX controls for developers to use with render arrays.

Namespace

Drupal\Core\Htmx

Code

protected function urlValue(Url $url) : string {
  $generatedUrl = $url->toString(TRUE);
  $this->cacheableMetadata
    ->addCacheableDependency($generatedUrl);
  return $generatedUrl->getGeneratedUrl();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.