function HtmxRequestInfoTrait::getHtmxCurrentUrl

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

Retrieves the URL of the requesting page from an HTMX request header.

Return value

string The value of the 'HX-Current-URL' header, or an empty string if not set.

File

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

Class

HtmxRequestInfoTrait
Provides methods for getting information about the HTMX request.

Namespace

Drupal\Core\Htmx

Code

protected function getHtmxCurrentUrl() : string {
  return $this->getRequest()->headers
    ->get('HX-Current-URL', '');
}

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