You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(theme): add environment variable support for theme selection
- Add BOILERPLATE_THEME environment variable to control theme selection dynamically
- Implement automatic theme validation with fallback to default theme
- Update theme configuration to support environment-based theme switching
- Document environment variable method as recommended approach for theme changes
- Enhance documentation with complete setup instructions and validation details
Copy file name to clipboardExpand all lines: docs/docs/8.x/howto/change_theme.md
+35-7Lines changed: 35 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,34 @@
1
1
# Change theme
2
2
3
-
To change the theme, you must define it in the [`config/theme.php`](/configuration/theme) file.
3
+
To change the theme, you can use the `BOILERPLATE_THEME` environment variable in your `.env` file or define it directly in the [`config/theme.php`](/configuration/theme) file.
4
4
5
-
All you have to do is to include the theme file you want to use :
5
+
## Method 1: Environment Variable (Recommended)
6
+
7
+
Add the theme name to your `.env` file:
8
+
9
+
```env
10
+
BOILERPLATE_THEME=black
11
+
```
12
+
13
+
## Method 2: Direct Configuration
14
+
15
+
You can also manually modify the theme in your `config/boilerplate/theme.php` file:
6
16
7
17
```php
8
-
$theme = include __DIR__.'/themes/default.php';
18
+
// Selected theme
19
+
$selectedTheme = env('BOILERPLATE_THEME', 'red'); // Change default here
> Available themes are `default`, `black`, `red`. The system automatically validates theme existence and falls back to default if the specified theme is not found.
@@ -18,11 +38,19 @@ $theme = include __DIR__.'/themes/default.php';
18
38
19
39
## Create a new theme
20
40
21
-
You don't have to create a new theme, you can also edit the `default` theme. But it is recommanded to create a new theme, so you can add modifications without touching the default themes.
41
+
You don't have to create a new theme, you can also edit the `default` theme. But it is recommended to create a new theme, so you can add modifications without touching the default themes.
42
+
43
+
To create a new theme:
22
44
23
-
To create a new theme, just copy the `default.php` file in the `config` folder to a new theme file.
45
+
1. Copy the `default.php` file in the `config/boilerplate/themes/` folder to a new theme file (e.g., `custom.php`)
46
+
2. Modify your new theme file as needed
47
+
3. Set the `BOILERPLATE_THEME` environment variable to your new theme name:
48
+
49
+
```env
50
+
BOILERPLATE_THEME=custom
51
+
```
24
52
25
-
After that, just modify the theme included in `config/theme.php` by calling your new theme file.
53
+
The system will automatically load your custom theme. If the theme file doesn't exist, it will fallback to the default theme.
0 commit comments