function Htmx::onlyMainContent

Decides when to use the `drupal_htmx` wrapper format for Htmx requests.

Parameters

bool $toggle: Toggle to use the full HTML response or just the main content.

Return value

static returns self so that attribute methods may be chained.

See also

core/misc/htmx/htmx-assets.js

File

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

Class

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

Namespace

Drupal\Core\Htmx

Code

public function onlyMainContent(bool $toggle = TRUE) {
  $this->createBooleanAttribute('hx-drupal-only-main-content', $toggle);
  return $this;
}

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