Install

Works with Drupal: ^11.1 || ^12

Using Composer to manage Drupal site dependencies

Alternative installation files

Download tar.gz 73.27 KB
MD5: 8e088834e2ef8bb8a08e4a97793432e2
SHA-1: 87ad440570640bbd17f13519932a1b68683cd32b
SHA-256: fccae12039d91f1f6b53ed408bf08f8c4b0a97e89ecdaf16e779df9da448b912
Download zip 74.85 KB
MD5: 074b1ad18e0017b8a91f3ffe46f31c95
SHA-1: 92965621598f133668b3e14866c8496d2bf8a245
SHA-256: 0b11d9ce9a8fd5dcad395ec18a79ac8ad2bb8431c9a4018a292f6f7e78921b42

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.

Created by: afagioli
Created on: 6 Nov 2026 at 10:06 UTC
Last updated: 6 Nov 2026 at 10:06 UTC

Other releases