Please add a fallback option when we use dynamic data options such as text and images.
Please add a fallback option when we use dynamic data options such as text and images.
Yes I had the same idea recently. Maybe you could solve this directly in the dynamic tag like this: {post_title | Fallback}
Any updates on this? Would be great! Love the pipe symbol approach…
I would like to bump this up. Since we have fallbacks for images, this feature should be considered next, please.
@thomas Working on a new project now where i need to return a default value if {echo:strtotime({acf_business_hours_open_from})}
returns nothing for a condition to work. The fallback is {echo: strtotime('00:00')}
but i don’t know how to go about this. Without this, the condition is always true which causes the element to show even when it’s not supposed to show.
I wish someone would reply about this. What a lost opportunity. We need fallbacks for dynamic data!
As a workaround, you can create your own function that accepts a text value and fallback text, then return the value if it’s not empty or return the fallback text if it is. Something like:
PHP code:
<?php
function myFallbackText($text, $fallback) {
if (empty($text)) {
return $fallback;
} else {
return $text;
}
}
?>
Dynamic tag:
{echo:myFallbackText('{post_title}','Fallback Title')}
Without fall backs for dynamic data it causes a big problem on large sites where you have many custom fields on many pages.
We need an easy to use fallback system please!
Yes please, this is a must!
I submitted this idea on the Idea board here: https://bricksbuilder.io/ideas/ 3 days ago. It is yet to be approved/published there.
Still hasn’t been approved by the looks of it (and they just approved a different request to the idea board around icon field type in Meta Box). I really wish the Bricks’ team would improve the ideation process. [WIP] Concerns around the Ideation process. How are new requests handled in the Idea Board tool for Bricks Builder?
I’m surprised this feature hasn’t bee included in Bricks yet, many competitors have this (including Breakdance).
As soon as this idea is approved for voting on in the Idea Board, please let us know, I definitely want to upvote this one.
This doesn’t seem to work when your string contains brackets. eg: if {post title} is ‘Wordpress (WP)’. for some reason its like get wrongly evaluated as function.
I have also tried to add filter :value, :text, etc but didn’t work.
Does anyone know solution?
Yes fallback value is must have feature.
A very essential feature. Hopefully this feature will come to Bricks soon.
I guess that will come with global elements
@Sridhar Your idea has been published: https://bricksbuilder.io/ideas/#11060
Everyone: Feel free to add your comments to the new feature request.
We are also internally discussing how to approach this best…
As soon as we settle on a concept, we’ll move it to the roadmap.
I was hoping for Integration with Dynamic.ooo Dynamic Shortcodes.
It already offers a great way to add fallbacks to Dynamic Data. Does anyone else see potential value in this?
For some reason, the comment for isn’t loading for this feature request.
Here are some syntax i’ll suggest
{{acf_text_field (fallback_value) }}
which should work for instances where we have filters e.g {{acf_url_field:plain (fallback_value) }}
the fall back is in brackets and would always be the last argument. The fallback value should accept dynamic data e.g {{acf_url_field:plain ({{dynamic_fallback_value}}) }}
Another option is using pipe as suggested by @claudio e.g {{acf_text_field | fallback_value}}
Guys. I don’t know where all the noise comes from but the solution is simple.
function FallbackText($text, $fallback) {
$text = bricks_render_dynamic_data('{' . $text . '}');
return ($text) ? $text : $fallback;
}
{echo:FallbackText(post_excerpt, Fallback Title)}
That took at least a month and a half to add to the ideas board after being submitted. I really hope that my detailed post will be considered because we still have too many issues with the ideation process IMO.
@d19dotca I’m sure you are well aware of all the work we did since the security incident at the start of February was reported, and on which we’ve been focusing ever since, instead of treating this like any other regular period. As all other development was pretty much halted during this time, including the idea board, etc. Thank you for caring and your understanding.