function Htmx::vals

Creates a `data-hx-vals` attribute.

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

The value of this attribute is a list of name-expression values which will be converted to JSON (JavaScript Object Notation) format.

Parameters

array<string, string> $values: The values in an array of 'name' => 'value' pairs.

Return value

static Returns this object to allow chaining methods.

See also

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

File

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

Class

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

Namespace

Drupal\Core\Htmx

Code

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

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