function Htmx::disable

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Htmx/Htmx.php \Drupal\Core\Htmx\Htmx::disable()

Creates a `data-hx-disable` attribute.

This attribute instructs HTMX to add the disabled attribute to the specified elements during a request.

The descriptor syntax is the same as hx-target. See the documentation link below for more details.

Parameters

string $descriptor: The attribute value.

bool $merge: Use the merge modifier to merge parent values for a disabled element.

int $modifiers: The modifiers to apply to the attribute. Defaults to no modifiers.

Return value

static Returns this object to allow chaining methods.

See also

https://four.htmx.org/reference/attributes/hx-disable

File

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

Class

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

Namespace

Drupal\Core\Htmx

Code

public function disable(string $descriptor, bool $merge = FALSE, int $modifiers = self::NO_MODIFIER) : static {
  $name = $merge ? 'hx-disable:merge' : 'hx-disable';
  $this->createStringAttribute($name, $descriptor, $modifiers);
  return $this;
}

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