function Htmx::historyElt
Same name and namespace in other branches
- 11.x core/lib/Drupal/Core/Htmx/Htmx.php \Drupal\Core\Htmx\Htmx::historyElt()
Creates a `data-hx-history-elt` attribute.
The hx-history-elt attribute marks the element that htmx should swap when restoring a page from history (back/forward navigation). Only this element is replaced — the rest of the page is left untouched.
As this attribute always marks a single element, modifiers are not applicable.
Return value
static Returns this object to allow chaining methods.
See also
https://four.htmx.org/attributes/hx-history-elt/
File
-
core/
lib/ Drupal/ Core/ Htmx/ Htmx.php, line 1161
Class
- Htmx
- Presents the HTMX controls for developers to use with render arrays.
Namespace
Drupal\Core\HtmxCode
public function historyElt() : static {
$this->createBooleanAttribute('hx-history-elt', TRUE, self::NO_MODIFIER);
return $this;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.