function Htmx::request

Creates a `data-hx-request` attribute.

This attribute instructs HTMX to configure various aspects of the request.

The hx-request attribute supports the following configuration values:

  • timeout: (integer) the timeout for the request, in milliseconds.
  • credentials: (boolean) if the request will send credentials.
  • noHeaders: (boolean) strips all headers from the request.

Dynamic javascript values are not supported for security and for simplicity. If you need calculated values you should do determine them here on the server-side

Parameters

array<string, int|bool> $configValues: The configuration values as name => value.

Return value

static Returns this object to allow chaining methods.

See also

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

File

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

Class

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

Namespace

Drupal\Core\Htmx

Code

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

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