function Htmx::get

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

Creates a `data-hx-get` attribute.

This attribute instructs HTMX to issue a GET request to the specified URL.

This request method also accepts no parameters, which issues a get request to the current url. If parameters are used, both are required.

Parameters

\Drupal\Core\Url|null $url: The URL for the GET request. If NULL, the current page is used without the query parameters.

Return value

static returns self so that attribute methods may be chained.

See also

https://htmx.org/attributes/hx-get/

File

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

Class

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

Namespace

Drupal\Core\Htmx

Code

public function get(?Url $url = NULL) : static {
  return $this->buildRequestAttribute('hx-get', $url);
}

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