function Htmx::params

Creates a `data-hx-params` attribute.

This attribute instructs HTMX to filter the parameters that will be submitted with a request.

Verify the current filter syntax at the link below.

  • To include all parameters, use the string '*'.
  • To pass no parameters use 'none'.
  • To exclude some parameters use an array of parameters names, prefixing the first name with `not`, as in ['not param1', 'param2', 'param3'].
  • To only submit some parameters, use an array of parameter names as in ['param1', 'param2', 'param3'].

parameters use an array, pre

Parameters

string|string[] $filter: The filter string or strings.

Return value

static Returns this object to allow chaining methods.

See also

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

File

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

Class

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

Namespace

Drupal\Core\Htmx

Code

public function params(string|array $filter) : static {
  if (is_array($filter)) {
    $filter = implode(',', $filter);
  }
  $this->createStringAttribute('hx-params', $filter);
  return $this;
}

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