Files
timebank-cc-public/app/Providers/ThemeServiceProvider.php
Ronald Huynen 2547717edb Initial commit
2026-03-23 21:37:59 +01:00

63 lines
1.7 KiB
PHP

<?php
namespace App\Providers;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\ServiceProvider;
class ThemeServiceProvider extends ServiceProvider
{
/**
* Register services.
*/
public function register(): void
{
//
}
/**
* Bootstrap services.
*/
public function boot(): void
{
// Register @theme Blade directive
Blade::directive('theme', function ($expression) {
return "<?php echo theme({$expression}); ?>";
});
// Register @themeId Blade directive
Blade::directive('themeId', function () {
return "<?php echo theme_id(); ?>";
});
// Register @themeName Blade directive
Blade::directive('themeName', function () {
return "<?php echo theme_name(); ?>";
});
// Register @themeColor Blade directive
Blade::directive('themeColor', function ($expression) {
return "<?php echo theme_color({$expression}); ?>";
});
// Register @themeFont Blade directive
Blade::directive('themeFont', function ($expression) {
return "<?php echo theme_font({$expression}); ?>";
});
// Register @isTheme Blade directive
Blade::directive('isTheme', function ($expression) {
return "<?php if (is_theme({$expression})): ?>";
});
// Register @endIsTheme Blade directive
Blade::directive('endIsTheme', function () {
return "<?php endif; ?>";
});
// Register @themeCssVars Blade directive
Blade::directive('themeCssVars', function () {
return "<?php echo theme_css_vars(); ?>";
});
}
}