function Htmx::pushUrlHeader

Set HX-Push-Url header.

Parameters

\Drupal\Core\Url|false $value: URL to push to the location bar or false to prevent a history update.

Return value

static Self for chaining.

See also

https://htmx.org/headers/hx-push-url/

File

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

Class

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

Namespace

Drupal\Core\Htmx

Code

public function pushUrlHeader(Url|false $value) : static {
  $url = 'false';
  if ($value instanceof Url) {
    $url = $this->urlValue($value);
  }
  $this->headers
    ->set('HX-Push-Url', $url);
  return $this;
}

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