function Htmx::createBooleanAttribute

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Htmx/Htmx.php \Drupal\Core\Htmx\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.

int $modifiers: The modifiers to apply to the attribute id.

6 calls to Htmx::createBooleanAttribute()
Htmx::historyElt in core/lib/Drupal/Core/Htmx/Htmx.php
Creates a `data-hx-history-elt` attribute.
Htmx::ignore in core/lib/Drupal/Core/Htmx/Htmx.php
Creates a `data-hx-ignore` attribute.
Htmx::morphSkip in core/lib/Drupal/Core/Htmx/Htmx.php
Creates a `data-hx-morph-skip` attribute.
Htmx::morphSkipChildren in core/lib/Drupal/Core/Htmx/Htmx.php
Creates a `data-hx-morph-skip-children` attribute.
Htmx::onlyMainContent in core/lib/Drupal/Core/Htmx/Htmx.php
Decides when to use the `drupal_htmx` wrapper format for Htmx requests.

... See full list

File

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

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, int $modifiers) : void {
  $key = $this->keyWithModifiers($id, $modifiers);
  $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.