diff --git a/README.md b/README.md index a9792bf..37beff8 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ The Playground Blade package for [Laravel](https://laravel.com/docs/11.x) applic This package provides Blade UI handling. -Read more on using Playground Blade [at the Read the Docs for Playground.](https://gammamatrix-playground.readthedocs.io/) +Read more on using [Playground Blade at Read the Docs: Playground Documentation.](https://gammamatrix-playground.readthedocs.io/en/latest/playground/blade.html) ## Installation diff --git a/composer.json b/composer.json index c881ee4..2a46b28 100644 --- a/composer.json +++ b/composer.json @@ -8,7 +8,7 @@ "playground", "playground-blade" ], - "homepage": "https://gammamatrix-playground.readthedocs.io/", + "homepage": "https://gammamatrix-playground.readthedocs.io/en/latest/playground/blade.html", "license": "MIT", "authors": [ { diff --git a/config/playground-blade.php b/config/playground-blade.php index 8396cd5..98534b3 100644 --- a/config/playground-blade.php +++ b/config/playground-blade.php @@ -19,7 +19,7 @@ 'themes' => [ 'default' => [ 'bsTheme' => '', - 'enable' => (bool) env('PLAYGROUND_BLADE_THEME_DEFAULT_ENABLE', true), + 'enable' => (bool) env('PLAYGROUND_BLADE_THEME_DEFAULT_ENABLE', false), 'label' => 'Default Theme', 'key' => 'default', 'icon' => 'fa-solid fa-square', @@ -45,6 +45,52 @@ // ], // ], ], + 'dark' => [ + 'bsTheme' => 'dark', + 'enable' => (bool) env('PLAYGROUND_BLADE_THEME_DARK_ENABLE', true), + 'label' => 'Dark Theme', + 'key' => 'dark', + 'icon' => 'fa-solid fa-moon', + 'provider' => 'bootstrap', + 'session' => true, + 'background' => [ + 'image' => '/vendor/playground/backgrounds/oval-dark.svg', + // 'image' => '/vendor/playground/backgrounds/spiral-dark.svg', + 'repeat' => 'no-repeat', + ], + 'head' => [ + 'ckeditor-bootstrap' => [ + 'rel' => 'stylesheet', + 'asset' => 'stylesheet', + 'href' => '/vendor/playground/ckeditor/bootstrap-dark.css', + 'version' => '41.2.0', + 'always' => true, + ], + ], + ], + 'light' => [ + 'bsTheme' => 'light', + 'enable' => (bool) env('PLAYGROUND_BLADE_THEME_LIGHT_ENABLE', true), + 'label' => 'Light Theme', + 'key' => 'light', + 'icon' => 'fa-solid fa-sun', + 'provider' => 'bootstrap', + 'session' => true, + 'background' => [ + 'image' => '/vendor/playground/backgrounds/oval-dark.svg', + // 'image' => '/vendor/playground/backgrounds/spiral-dark.svg', + 'repeat' => 'no-repeat', + ], + 'head' => [ + 'ckeditor-bootstrap' => [ + 'rel' => 'stylesheet', + 'asset' => 'stylesheet', + 'href' => '/vendor/playground/ckeditor/bootstrap-light.css', + 'version' => '41.2.0', + 'always' => true, + ], + ], + ], 'blue' => [ 'bsTheme' => 'blue', 'enable' => (bool) env('PLAYGROUND_BLADE_THEME_BLUE_ENABLE', true), @@ -343,52 +389,6 @@ ], ], ], - 'dark' => [ - 'bsTheme' => 'dark', - 'enable' => (bool) env('PLAYGROUND_BLADE_THEME_DARK_ENABLE', true), - 'label' => 'Dark Theme', - 'key' => 'dark', - 'icon' => 'fa-solid fa-moon', - 'provider' => 'bootstrap', - 'session' => true, - 'background' => [ - 'image' => '/vendor/playground/backgrounds/oval-dark.svg', - // 'image' => '/vendor/playground/backgrounds/spiral-dark.svg', - 'repeat' => 'no-repeat', - ], - 'head' => [ - 'ckeditor-bootstrap' => [ - 'rel' => 'stylesheet', - 'asset' => 'stylesheet', - 'href' => '/vendor/playground/ckeditor/bootstrap-dark.css', - 'version' => '41.2.0', - 'always' => true, - ], - ], - ], - 'light' => [ - 'bsTheme' => 'light', - 'enable' => (bool) env('PLAYGROUND_BLADE_THEME_LIGHT_ENABLE', true), - 'label' => 'Light Theme', - 'key' => 'light', - 'icon' => 'fa-solid fa-sun', - 'provider' => 'bootstrap', - 'session' => true, - 'background' => [ - 'image' => '/vendor/playground/backgrounds/oval-dark.svg', - // 'image' => '/vendor/playground/backgrounds/spiral-dark.svg', - 'repeat' => 'no-repeat', - ], - 'head' => [ - 'ckeditor-bootstrap' => [ - 'rel' => 'stylesheet', - 'asset' => 'stylesheet', - 'href' => '/vendor/playground/ckeditor/bootstrap-light.css', - 'version' => '41.2.0', - 'always' => true, - ], - ], - ], ], /* |-------------------------------------------------------------------------- diff --git a/src/Concerns/WithThemes.php b/src/Concerns/WithThemes.php index 6c147f8..1fd62cd 100644 --- a/src/Concerns/WithThemes.php +++ b/src/Concerns/WithThemes.php @@ -59,9 +59,14 @@ public function initThemes(): self /** * @param array $themes */ - public function loadThemes(array $themes = []): self + public function loadThemes(array $themes = [], bool $enabled = true): self { foreach ($themes as $key => $meta) { + if ($enabled) { + if (! is_array($meta) || empty($meta['enable'])) { + continue; + } + } // Only Bootstrap themes are supported for now. if ($key && is_string($key)) {