Broader environment variable support #10111
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds new
selectize
andselectizeField
macros to_includes/forms
, which make it easier to create Selectize-based select menus. These support anincludeEnvVars
setting, which can be set totrue
to include any defined environment variables which are set to one of the available option values.There’s also new
booleanMenu
andbooleanMenuField
macros, which extendselectize
/selectizeField
for cases where a boolean value is needed. Their options are “Yes” (0
) and “No” (1
), and supportyesLabel
andnoLabel
settings to override the labels.When
includeEnvVars
is set totrue
, they will only include environment variables that are set to a boolean-esque value:on
,off
,yes
,no
,true
,false
,1
, or0
(case insensitive).There’s also a new
Craft::parseBooleanEnv()
method, which should be used to normalize a boolean menu’s value totrue
orfalse
at runtime (but that normalized value should not be stored, as we don’t want to lose the original environment variable name).The following settings have been updated to support environment variables:
Resolves #8866
Resolves #8989
Possibly alleviates #9855