[All Adaptavist Apps]
Excerpt |
---|
This macro defines a flag and sets its state to either true or false. |
If you've not already done so, it would be worth reading Working with Flags to gain a better understanding of what they are, why they are used and where to use them.
We recommend using Builder 3.3.6 or above to benefit from additional flag-aware macros.
Code Block |
---|
{set-flag:foo} {set-flag:foo|state=false} |
Property | Required | Default | Notes | Ver |
---|---|---|---|---|
default |
| The default parameter defines the name of the flag (eg. 'foo' in the usage section above) | 3.3.4 | |
state |
| Defines the state for the flag:
| 3.3.4 | |
flag |
| The flag state is changed only if one or more of the specified flags are set. See Working with Flags for more details. | 3.3.6 | |
notflag |
| The flag state is changed only if none of the specified flags are set. See Working with Flags for more details. | 3.3.6 |
To set the 'foo' flag to state true
, use:
No Format |
---|
{set-flag:foo} |
To clear the 'foo' flag, set it's state to false:
No Format |
---|
{set-flag:foo|state=false} |
To set the 'foo' flag only when viewing a blogpost, for example, use:
No Format |
---|
{builder-show:context=blogpost} {set-flag:foo} {builder-show} |
Refer to builder-show macro, builder-hide macro, bubbles-show macro and bubbles-hide macro for a more complete list of the conditions that can be used.
When a flag is set to true
a class will be added to the HTML <body> tag. For example, if the 'foo' flag has been set, the class will be called 'flag-foo' and will appear as follows:
Code Block |
---|
<body class="flag-foo" ... |
You can then prefix your CSS styles with this flag so that they only become active when the flag is set, for example:
Code Block |
---|
.flag-foo h1 { color: #0f0; } |
In the example above the heading 1 colour would change to green when the 'foo' flag is set to true
.
See Working with Flags for more information on working with flags and a full list of flag-aware macros.
None at present.