function Htmx::headers

Creates a `data-hx-headers` attribute.

This attribute instructs HTMX to add to the headers that will be submitted with an HTMX request.

Parameters

array<string, string> $headerValues: The header values as name => value.

Return value

static Returns this object to allow chaining methods.

See also

https://htmx.org/attributes/hx-headers/

File

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

Class

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

Namespace

Drupal\Core\Htmx

Code

public function headers(array $headerValues) : static {
  $this->createJsonAttribute('hx-headers', $headerValues);
  return $this;
}

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