Skip to content

Commit 541acef

Browse files
committed
Update README
1 parent d598931 commit 541acef

File tree

1 file changed

+39
-2
lines changed

1 file changed

+39
-2
lines changed

README.md

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ $envs = [
1818
'staging' => 'http://staging.example.com',
1919
'production' => 'http://example.com'
2020
];
21-
define('ENVIRONMENTS', serialize($envs));
21+
Config::define('ENVIRONMENTS', serialize($envs));
2222
```
2323

2424
Note: the `serialize()` call is not needed on PHP 7.0 or newer.
2525

2626
`WP_ENV` must be defined as the current environment:
2727

2828
```php
29-
define('WP_ENV', 'development');
29+
Config::define('WP_ENV', 'development');
3030
```
3131

3232
If you use [Bedrock](https://github.com/roots/bedrock), `WP_ENV` is already defined in the config.
@@ -49,6 +49,43 @@ Or manually add it to your `composer.json`:
4949
}
5050
```
5151

52+
## Filters
53+
54+
### `bedrock/stage_switcher_colors`
55+
56+
Customize the background colors for each environment in the admin bar menu. Returns an array of `'environment' => 'color'` pairs.
57+
58+
Default colors:
59+
```php
60+
[
61+
'development' => 'firebrick',
62+
'staging' => 'chocolate',
63+
'production' => 'transparent',
64+
]
65+
```
66+
67+
Example usage:
68+
```php
69+
add_filter('bedrock/stage_switcher_colors', function ($colors) {
70+
return [
71+
'development' => '#dc2626',
72+
'staging' => '#ea580c',
73+
'production' => '#10b981',
74+
];
75+
});
76+
```
77+
78+
### `bedrock/stage_switcher_visibility`
79+
80+
Control who can see the stage switcher in the admin bar. Defaults to `is_super_admin()`.
81+
82+
Example usage:
83+
```php
84+
add_filter('bedrock/stage_switcher_visibility', function ($visible) {
85+
return current_user_can('manage_options');
86+
});
87+
```
88+
5289
## Support
5390

5491
Use the [Roots Discourse](http://discourse.roots.io/) to ask questions and get support.

0 commit comments

Comments
 (0)