Skip to content

Commit 7591baf

Browse files
committed
docs(dynamix): use exported $theme directly, don't reassign
Remove $theme = $Dynamix['theme'] pattern since $theme and other $Dynamix entries are already exported as top-level variables in .page files. Add note warning against mutating shared variables. Thanks @Squidly271 in issue #2
1 parent 73aae68 commit 7591baf

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

docs/core/dynamix-framework.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,11 @@ The `$Dynamix` array contains essential configuration and state information abou
2525
// Access the Dynamix configuration
2626
global $Dynamix;
2727

28-
// Example: Check current theme
29-
$theme = $Dynamix['theme'];
28+
// Exported variables like $theme are already available in page files
29+
// and mirror values from $Dynamix.
30+
if ($theme === 'black') {
31+
// dark theme logic
32+
}
3033
?>
3134
```
3235

@@ -89,9 +92,6 @@ $formattedNumber = number_format($value, 2, $decimal, $thousands);
8992
9093
```php
9194
<?
92-
global $Dynamix;
93-
94-
$theme = $Dynamix['theme'];
9595
$isDarkTheme = in_array($theme, ['black', 'gray']);
9696
?>
9797

@@ -110,6 +110,9 @@ $isDarkTheme = in_array($theme, ['black', 'gray']);
110110
</style>
111111
```
112112
113+
{: .note }
114+
> In `.page` files, variables like `$theme` are already exported. Avoid reassigning or mutating these shared variables.
115+
113116
### Theme CSS Variables
114117
115118
Unraid themes define CSS variables you can use for consistent styling:

0 commit comments

Comments
 (0)