function Htmx::swapOob

Creates a `data-hx-swap-oob` attribute.

This attribute is used in the markup of the returned response. It specifies that some content in a response should be swapped into the DOM somewhere other than the target, that is “Out of Band”. This allows you to piggyback updates to other elements on a response.

Parameters

true|string $value: Either true, a swap strategy, or strategy:CSS-selector.

Return value

static Returns this object to allow chaining methods.

See also

https://htmx.org/attributes/hx-swap-oob/

File

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

Class

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

Namespace

Drupal\Core\Htmx

Code

public function swapOob(true|string $value) : static {
  if ($value === TRUE) {
    $value = 'true';
  }
  $this->createStringAttribute('hx-swap-oob', $value);
  return $this;
}

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