Unable to parse no_results conditional for an Assets + Low Variables.
Hi Low,
I'm running Low Variables 2.3.4, Assets 2.0.5, EE 2.5.3. I have a Low Variables set up with an Assets field, and want to add a template conditional for when our client has yet to select any files to go in said Assets field.
However no matter what I try, {if no_results}...{/if} is never parsed. Here's what I would have expected to work:
{exp:low_variables:pair
var="lv_my_variable"}
{if no_results}
No Image!
{/if}
<img src="{url}" />
{/exp:low_variables:pair}
Any advice?
Cheers!
John
Replies
Low 28 Feb 2013 10:49
Actually, it's Assets' responsibility to return the no_results data, not LV. Have you asked P&T the same question?
johndwells 28 Feb 2013 10:52
I haven't but that was going to be my next port of call, I thought you might say that!
Cheers,
John
Low 28 Feb 2013 10:54
FYI, LV calls the 'display_var_tag' method of the fieldtype, which returns whatever it wants to return. LV doesn't know if an empty string is the correct value, and therefore cannot guess what is in fact 'no_results' by looking at the return value.
Instead, the fieldtype should check the input (tagdata, parameters, given var value) and return the parsed tagdata or the no_results data where applicable.