liberusoftware / module-cms-themes
Theme engine for Liberu CMS: registration, inheritance, override resolution, and switching of Blade themes.
Package info
github.com/liberusoftware/module-cms-themes
Type:liberu-module
pkg:composer/liberusoftware/module-cms-themes
Requires
- php: ^8.5
- filament/filament: ^5.11.0
- illuminate/contracts: ^13.38.0
- illuminate/database: ^13.38.0
- illuminate/support: ^13.38.0
- liberusoftware/module-cms-contracts: ^0.1
- liberusoftware/module-cms-core: ^0.1
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-14 19:55:36 UTC
README
Repository
Source, issues, and release history: https://github.com/liberusoftware/module-cms-themes
Composer package: https://packagist.org/packages/liberusoftware/module-cms-themes
The theme engine for Liberu CMS: register Blade themes, inherit from a parent theme, resolve view overrides along the inheritance chain, and switch the active theme at runtime.
Concepts
- A theme (
ThemeInterface) is a named views directory with an optional parent. Register the built-inThemevalue class or your own descriptor. - The active theme is persisted (in
cms_theme_state) and falls back to the configured default; the module registers adefaulttheme pointing atresources/views. - Override resolution:
resolveView('layouts.app')walks the active theme then its ancestors and returns the first matching file — so a child theme need only override the views it changes. At boot, the active theme's view paths are prepended to Blade's finder, so ordinaryview()calls pick up overrides.
$themes = app(\Liberu\Cms\Contracts\Theme\ThemeManagerInterface::class); $themes->register(new Theme('base', 'Base', '/themes/base/views')); $themes->register(new Theme('shop', 'Shop', '/themes/shop/views', parent: 'base')); $themes->setActive('shop'); // → ThemeActivated event $themes->resolveView('home'); // /themes/shop/views/home.blade.php $themes->resolveView('layouts.app'); // falls back to /themes/base/views/... $themes->inheritanceChain(); // [shop, base]
Config (config/cms-themes.php)
| Key | Default | Purpose |
|---|---|---|
default |
default |
Theme key used when none is active. |
Events
- Emits:
Theme\ThemeActivatedon switch. - Listens: none.
Public contracts
ThemeManagerInterface, ThemeInterface (in cms-contracts).