function Htmx::buildRequestAttribute
Same name and namespace in other branches
- 11.x core/lib/Drupal/Core/Htmx/Htmx.php \Drupal\Core\Htmx\Htmx::buildRequestAttribute()
Utility function for the request attributes.
Provides the logic for the request attribute methods. Separate public methods are maintained for clear correspondence with the attributes of HTMX.
Parameters
string $method: The request method.
\Drupal\Core\Url|null $url: The URL for the request. If NULL, is passed it will use the current URL without any query parameter.
Return value
static returns self so that attribute methods may be chained.
File
-
core/
lib/ Drupal/ Core/ Htmx/ Htmx.php, line 208
Class
- Htmx
- Presents the HTMX controls for developers to use with render arrays.
Namespace
Drupal\Core\HtmxCode
protected function buildRequestAttribute(string $method, ?Url $url = NULL) : static {
if (is_null($url)) {
$request_url = Url::fromRoute('<none>');
}
else {
// The Htmx helper should not modify the original URL object.
$request_url = clone $url;
}
$this->createStringAttribute($method, $this->urlValue($request_url));
return $this;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.