Install
Works with Drupal: ^11.1 || ^12Using Composer to manage Drupal site dependencies
Alternative installation files
Release notes
## Drupal 11.1 / 12 compatibility
This release is a full rewrite of the module to support Drupal 11.1+ and Drupal 12.
### Changes
- **OOP hooks**: `hook_page_attachments()` is now implemented as a class
(`Drupal\onsen\Hook\OnsenHooks`) with the `#[Hook]` attribute. Procedural
hooks are no longer supported in Drupal 12.
- **Fixed deprecated service**: `Drupal\Core\Path\AliasManagerInterface` has
been replaced with `Drupal\path_alias\AliasManagerInterface`.
- **CDN assets**: Onsen UI CSS/JS are loaded from unpkg (`onsenui@2.12.8`)
instead of local files. No local `js/` or `css/` directory is shipped.
- **Demo page**: `/onsen-demo` now renders a scrollable demo of the main
CSS components (switch, checkbox, radio, range, input, select, buttons,
card, toolbar). This page is always whitelisted and loads the library
regardless of the configuration.
- **Configuration form**: `/admin/config/onsen/settings` now includes a
link to the demo page and an explicit note about the whitelist.
- **Removed**: `templates/ons-switch.html.twig` and the old demo template
(the demo is now rendered by a controller).
- **Breaking changes**: any custom override of `ons-switch.html.twig` will
no longer be used. The `pages` config key is unchanged.
### Upgrade path
1. Update the module code.
2. Run `drush cr`.
3. Review `/admin/config/onsen/settings` and re-save the path patterns
if needed.
### Known trade-offs
- Assets are loaded from a CDN. If you have a strict Content Security Policy
or need local assets for privacy reasons, override
`onsen/onsen-ui` in your theme's `libraries.yml`.
- The demo page uses inline HTML in the controller, not a Twig template.
This is intentional for simplicity, but means the demo is not themable
via template overrides.