function HtmxRequestInfoTrait::isHtmxRequest

Determines if the request is sent by HTMX.

Return value

bool TRUE if the 'HX-Request' header is present.

1 call to HtmxRequestInfoTrait::isHtmxRequest()
HtmxRequestInfoTest::testIsHtmxRequest in core/tests/Drupal/Tests/Core/Htmx/HtmxRequestInfoTest.php
Tests the isHtmxRequest method.

File

core/lib/Drupal/Core/Htmx/HtmxRequestInfoTrait.php, line 26

Class

HtmxRequestInfoTrait
Provides methods for getting information about the HTMX request.

Namespace

Drupal\Core\Htmx

Code

protected function isHtmxRequest() : bool {
  return $this->getRequest()->headers
    ->has('HX-Request');
}

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