function Htmx::patch

Creates a `data-hx-patch` attribute.

This attribute instructs HTMX to issue a PATCH request

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

Parameters

\Drupal\Core\Url|null $url: Collects the cacheable metadata from the URL generation.

Return value

static returns self so that attribute methods may be chained.

See also

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

File

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

Class

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

Namespace

Drupal\Core\Htmx

Code

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

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