mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #10079 from patricknelson/patch-10
DOC Document the capability of 'envorconstant' to be checked against specific values
This commit is contained in:
commit
c74f368bf4
@ -334,15 +334,15 @@ rules contained match.
|
||||
|
||||
You then list any of the following rules as sub-keys, with informational values as either a single value or a list.
|
||||
|
||||
- 'classexists', in which case the value(s) should be classes that must exist
|
||||
- 'moduleexists', in which case the value(s) should be modules that must exist. This supports either folder
|
||||
- `classexists`, in which case the value(s) should be classes that must exist
|
||||
- `moduleexists`, in which case the value(s) should be modules that must exist. This supports either folder
|
||||
name or composer `vendor/name` format.
|
||||
- 'environment', in which case the value(s) should be one of "live", "test" or "dev" to indicate the Silverstripe CMS
|
||||
- `environment`, in which case the value(s) should be one of "live", "test" or "dev" to indicate the Silverstripe CMS
|
||||
mode the site must be in
|
||||
- 'envvarset', in which case the value(s) should be environment variables that must be set
|
||||
- 'constantdefined', in which case the value(s) should be constants that must be defined
|
||||
- 'envorconstant' A variable which should be defined either via environment vars or constants
|
||||
- 'extensionloaded', in which case the PHP extension(s) must be loaded
|
||||
- `envvarset`, in which case the value(s) should be environment variables that must be set
|
||||
- `constantdefined`, in which case the value(s) should be constants that must be defined
|
||||
- `envorconstant`, a variable which should be defined either via environment vars or constants (and optionally be set to a specific value)
|
||||
- `extensionloaded`, in which case the PHP extension(s) must be loaded
|
||||
|
||||
For instance, to add a property to "foo" when a module exists, and "bar" otherwise, you could do this:
|
||||
|
||||
@ -374,6 +374,18 @@ Only:
|
||||
---
|
||||
```
|
||||
|
||||
The `envorconstant` rule allows you to get even more specific by also directly comparing values of environment variables
|
||||
and constants. In this example, both `TEST_ENV` and `TEST_CONST` have to be defined _and_ set to certain values:
|
||||
|
||||
```yaml
|
||||
---
|
||||
Only:
|
||||
envorconstant:
|
||||
TEST_ENV: 'example'
|
||||
TEST_CONST: true
|
||||
---
|
||||
```
|
||||
|
||||
[alert]
|
||||
When you have more than one rule for a nested fragment, they're joined like
|
||||
`FRAGMENT_INCLUDED = (ONLY && ONLY) && !(EXCEPT && EXCEPT)`.
|
||||
|
Loading…
Reference in New Issue
Block a user