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)
If you use a bloq_var in a conditional, you will need to quote it, e.g. {if ‘{bloq_var_columns}’ > 2}
Josh Brodleit
Maybe I’m missing how to configure, but not getting anything to ouput using that syntax either:
BoldMinded (Brian)
And you prefixed the atom name? https://www.dropbox.com/s/4eoo6fnaz2r4rxs/ticket-2205-bloq-var.png?dl=0
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)
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
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)
Yes you can, but color_background_override needs to be named bloq_var_color_background_override
Josh Brodleit
ok, added that and still not ouputting…unless again, I’m missing something here
Parent Bloq
Child bloq
BoldMinded (Brian)
https://www.dropbox.com/s/qjwnop4a5kdnmlw/ticket-2205-config.png?dl=0 https://www.dropbox.com/s/q9hvg6wd0ay6wst/ticket-2205-slabs.png?dl=0 https://www.dropbox.com/s/ixe5yurrm091szw/ticket-2205-output.png?dl=0
BoldMinded (Brian)
BTW you can make those conditionals a lot simpler by using a regex (remember bloq_vars need to be quoted):
Josh Brodleit
Ok, sweet! Got it working properly now. Thank you providing the examples.
BoldMinded (Brian)
https://www.dropbox.com/s/4ndhxq740qe4xco/success.jpg?dl=0