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.
int $modifiers: The modifiers to apply to the request. Defaults to no modifiers.
Return value
static Returns self so that attribute methods may be chained.
7 calls to Htmx::buildRequestAttribute()
- Htmx::action in core/
lib/ Drupal/ Core/ Htmx/ Htmx.php - Creates a `data-hx-action` attribute.
- Htmx::delete in core/
lib/ Drupal/ Core/ Htmx/ Htmx.php - Creates a `data-hx-delete` attribute.
- Htmx::get in core/
lib/ Drupal/ Core/ Htmx/ Htmx.php - Creates a `data-hx-get` attribute.
- Htmx::patch in core/
lib/ Drupal/ Core/ Htmx/ Htmx.php - Creates a `data-hx-patch` attribute.
- Htmx::post in core/
lib/ Drupal/ Core/ Htmx/ Htmx.php - Creates a `data-hx-post` attribute.
File
-
core/
lib/ Drupal/ Core/ Htmx/ Htmx.php, line 246
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, int $modifiers = self::NO_MODIFIER) : 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), $modifiers);
return $this;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.