function Htmx::createBooleanAttribute

Utility method to create and store a boolean value as an attribute.

Parameters

string $id: The HTMX attribute id.

bool $value: The attribute value.

3 calls to Htmx::createBooleanAttribute()
Htmx::disable in core/lib/Drupal/Core/Htmx/Htmx.php
Creates a `data-hx-disable` attribute.
Htmx::historyElt in core/lib/Drupal/Core/Htmx/Htmx.php
Creates a `data-hx-history-elt` attribute.
Htmx::preserve in core/lib/Drupal/Core/Htmx/Htmx.php
Creates a `data-hx-preserve` attribute.

File

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

Class

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

Namespace

Drupal\Core\Htmx

Code

protected function createBooleanAttribute(string $id, bool $value) : void {
  $key = self::ATTRIBUTE_PREFIX . $id;
  $this->attributes[$key] = new AttributeBoolean($key, $value);
}

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