function Htmx::keyWithModifiers

Helper method to generate a key with modifiers applied.

Parameters

string $id: The base identifier for the key.

int $modifiers: The modifiers to apply to the key.

Return value

string The generated key with modifiers.

3 calls to Htmx::keyWithModifiers()
Htmx::createBooleanAttribute in core/lib/Drupal/Core/Htmx/Htmx.php
Utility method to create and store a boolean value as an attribute.
Htmx::createJsonAttribute in core/lib/Drupal/Core/Htmx/Htmx.php
Utility method to create and store an array as an attribute.
Htmx::createStringAttribute in core/lib/Drupal/Core/Htmx/Htmx.php
Utility method to create and store a string value as an attribute.

File

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

Class

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

Namespace

Drupal\Core\Htmx

Code

protected function keyWithModifiers(string $id, int $modifiers) : string {
  $id = self::ATTRIBUTE_PREFIX . $id;
  if ($modifiers & self::INHERITED) {
    $id = $id . ':inherited';
  }
  if ($modifiers & self::APPEND) {
    $id = $id . ':append';
  }
  return $id;
}

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