function Htmx::triggerAfterSwapHeader

Set HX-Trigger-After-Swap header.

See the documentation for the structure of the array.

Parameters

string|array $data: An event name or an array which will be JSON encoded.

Return value

static Self for chaining.

See also

https://htmx.org/headers/hx-trigger/

File

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

Class

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

Namespace

Drupal\Core\Htmx

Code

public function triggerAfterSwapHeader(string|array $data) : static {
  if (is_array($data)) {
    $data = json_encode($data);
  }
  $this->headers
    ->set('HX-Trigger-After-Swap', $data);
  return $this;
}

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