function TestHtmxHooks::boost
Same name and namespace in other branches
- main core/modules/system/tests/modules/test_htmx/src/Hook/TestHtmxHooks.php \Drupal\test_htmx\Hook\TestHtmxHooks::boost()
Implements hook_preprocess_HOOK() for html.
Attributes
#[Hook('preprocess_html')]
File
-
core/
modules/ system/ tests/ modules/ test_htmx/ src/ Hook/ TestHtmxHooks.php, line 22
Class
- TestHtmxHooks
- Hooks for the test_htmx module.
Namespace
Drupal\test_htmx\HookCode
public function boost(array &$variables) : void {
if ($this->routeMatch
->getRouteName() === 'test_htmx.attachments.body') {
$variables['#attached']['library'][] = 'core/drupal.htmx';
$variables['attributes']['data-hx-boost'] = 'true';
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.