function Htmx::confirm

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

Creates a `data-hx-confirm` attribute.

This attribute instructs HTMX to show a window.confirm dialog before issuing a request.

Parameters

string $message: The user facing message.

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-confirm

File

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

Class

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

Namespace

Drupal\Core\Htmx

Code

public function confirm(string $message, int $modifiers = self::NO_MODIFIER) : static {
  $this->createStringAttribute('hx-confirm', $message, $modifiers);
  return $this;
}

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