Publisher does not support the Fluid field type. Please do not contact asking when support will be available.
If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.
Ticket: bloq_var_ prefix - not able to get working
Status | Resolved |
Add-on / Version | Bloqs 4.4.0 |
Severity | |
EE Version | 5.4.0 |
Josh Brodleit
Dec 07, 2020Added
block_var_
prefix to a bloq, but conditional not outputting. Hoping to actually use this in a child bloq to do determine the “color_background_override” color to properly set font color in child blocks. Please advise and/or let me know if I’m missing something.
{bloq_wrapper_section bloq_var_some_key="some-value"}
{if bloq_var_some_key == "some-value"}
Do something
{/if}
<section
class="
{if color_background_override == 'light-grey' OR color_background_override == 'soft-white' OR color_background_override == 'white'}
t-text-dark
t-bg-{color_background_override}
{if:elseif color_background_override == 'dark-grey' OR color_background_override == 'soft-black' OR color_background_override == 'black'}
t-text-light
t-bg-{color_background_override}
{/if}
"
data-block-name="bloq_wrapper_section"
>
<div class="{section_width} pt-6__5 pb-7__5">
{close:bloq_wrapper_section}
</div>
</section>
{/close:bloq_wrapper_section}
{/bloq_wrapper_section}
BoldMinded (Brian)
Dec 07, 2020
If you use a bloq_var in a conditional, you will need to quote it, e.g. {if ‘{bloq_var_columns}’ > 2}
Josh Brodleit
Dec 07, 2020
Maybe I’m missing how to configure, but not getting anything to ouput using that syntax either:
BoldMinded (Brian)
Dec 07, 2020
And you prefixed the atom name?
For shits and giggles, try “block_var_” as the prefix and see if it works. Also try it without the conditional to make sure it’s printing the value.
BoldMinded (Brian)
Dec 07, 2020
This might be the issue too
If bloq_wrapper_section is a bloq, then it won’t work. Setting the bloq_var in this way only works on the parent field, e.g.
<pre><code>
{my_bloqs_field var_some_key=“some-value”}
{bloq_wrapper_section}
{/bloq_wrapper_section}
{/my_bloqs_field}
<pre><code>
You either set the variable on the bloqs field, or by prefixing an atom.
Josh Brodleit
Dec 07, 2020
Ok, so to clarify, the parent bloq, `bloq_wrapper_section` I wouldn’t be able to access that bloq’s atom value, `color_background_override` in a nested child bloq?
BoldMinded (Brian)
Dec 07, 2020
Yes you can, but color_background_override needs to be named bloq_var_color_background_override
Josh Brodleit
Dec 07, 2020
ok, added that and still not ouputting…unless again, I’m missing something here
Parent Bloq
Child bloq
BoldMinded (Brian)
Dec 07, 2020
BoldMinded (Brian)
Dec 07, 2020
BTW you can make those conditionals a lot simpler by using a regex (remember bloq_vars need to be quoted):
Josh Brodleit
Dec 07, 2020
Ok, sweet! Got it working properly now. Thank you providing the examples.
BoldMinded (Brian)
Dec 07, 2020