Most might have noticed that our Page Editor has a section called “Advanced Options” and under this section, there’s a field called Condition
This “obscure” option is actually really useful, as it decides whether that brick should run, or should not based on a condition.
The condition to run the brick is that the value must be true (or truthy) If the value is false (or falsy) this brick will not execute.
This condition can be any variable or expression or value, as long as they are truthy or falsy they will make it so that the brick will run, or not.
🧙♂️ Pro-tip:
When building mods, it happens often that you want to debug your work.
Sometimes there’s a brick that you don’t want to run, but at the same time you don’t want to fully delete it from the mod.
How can you prevent it from being triggered?
If you want to “pause” a brick from running without deleting it you can set the Condition to 0
or false
.
Viceversa, you can set the Condition to 1
or true
to always run that particular brick, regardless of other inputs
Here are some examples of Condition you can set:
Setting these values to the Condition will run the brick:
1
true
“this is a string”
However, setting it to one of the below options will not run the brick:
0
false
{{ false if @input.url }}
Conclusions
Hopefully this illustrate better how to use the Condition field in the Page Editor!
As per usual if you have question feel free to reach out in Slack or Social media!