function Htmx::replaceUrlHeader

Set HX-Replace-Url header.

Parameters

\Drupal\Core\Url|false $data: URL for history replacement, false prevents updates to the current URL.

Return value

static Self for chaining.

See also

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

File

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

Class

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

Namespace

Drupal\Core\Htmx

Code

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

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