function Htmx::inherit

Creates a `data-hx-inherit` attribute.

This attribute instructs HTMX how to control automatic attribute inheritance for child nodes.

HTMX evaluates attribute inheritance with hx-inherit in two ways when hx-inherit is set on a parent node:

  • data-hx-inherit="*" All attribute inheritance for this element will be enabled.
  • data-hx-hx-inherit="hx-select hx-get hx-target" Enable inheritance for only one or multiple specified attributes.

Parameters

string $attributes: The attributes to inherit.

Return value

static Returns this object to allow chaining methods.

See also

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

File

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

Class

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

Namespace

Drupal\Core\Htmx

Code

public function inherit(string $attributes) : static {
  $this->createStringAttribute('hx-inherit', $attributes);
  return $this;
}

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