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
Copy file name to clipboardExpand all lines: cms/themes.md
+9-3Lines changed: 9 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -307,6 +307,7 @@ themes/
307
307
```
308
308
309
309
In this example, when `my-custom-theme` is active:
310
+
310
311
- `theme.css`and `logo.png` load from the child theme
311
312
- `header.htm`loads from the child theme
312
313
- `footer.htm`loads from the parent theme (inherited)
@@ -349,49 +350,54 @@ When [database templates](#database-driven-themes) are enabled, you can:
349
350
3. Inherit all other files from the parent theme's filesystem
350
351
351
352
This approach allows you to:
353
+
352
354
- Manage hundreds of similar themes without duplicating files
353
355
- Update the parent theme and have changes cascade to all child themes automatically
354
356
- Store tenant-specific customizations in the database while sharing a common codebase
355
357
356
-
**Example: Creating a virtual child theme**
358
+
**Example:** Creating a virtual child theme
357
359
358
360
1. Enable database templates in `config/cms.php`:
359
361
360
362
```php
361
363
'databaseTemplates' => true,
362
364
```
363
365
364
-
2. Create a theme record in the database with just the `theme.yaml` content:
366
+
1. Create a theme record in the database with just the `theme.yaml` content:
365
367
366
368
```yaml
367
369
name: "Client A Custom Theme"
368
370
parent: base-theme
369
371
```
370
372
371
-
3. Customize only the templates that need to differ from the parent by saving them to the database
373
+
1. Customize only the templates that need to differ from the parent by saving them to the database
372
374
373
375
The child theme will now function without any physical directory, inheriting everything from `themes/base-theme` except for the database-stored customizations.
374
376
375
377
### Best Practices
376
378
377
379
**When to use child themes:**
380
+
378
381
- Customizing a third-party theme while preserving the ability to update it
379
382
- Creating multiple branded variations of a base theme
380
383
- Building a multi-tenant application where each tenant needs minor customizations
381
384
- Developing a theme framework where a base theme provides core functionality
382
385
383
386
**When to create a new theme instead:**
387
+
384
388
- Making extensive changes that affect most templates and assets
385
389
- Building something significantly different from the original design
386
390
- When you need to modify the theme structure itself
387
391
388
392
**Organization tips:**
393
+
389
394
- Keep child themes minimal - only override what's necessary
390
395
- Document which files are overridden and why
391
396
- Use clear, descriptive names for child themes (e.g., `mytheme-client-a`, `mytheme-blue-variant`)
392
397
- Consider using [theme customization](../themes/development#theme-customization) for simple configuration changes before creating a child theme
393
398
394
399
**Performance considerations:**
400
+
395
401
- Child themes have minimal performance impact - file resolution is cached
396
402
- Avoid deep nesting (grandparent/parent/child) - only one level of inheritance is supported
397
403
- Database-driven templates are cached, so virtual child themes perform well
0 commit comments