This is caused by the Dynamic Data mechanism which catches the {delay: 500, ...} as a dynamic data tag, and because it cannot render a value, it wipes out the “tag”. We’re working on a solution to exclude certain patterns from the Dynamic Data logic.
Thank you for letting us know about the workaround.
Having the same problem.
I have read the article and don’t unserstand what I need to do. Do I need to replace “my_specific_tag” by the name of the var? or what?
Thanks, something happened, but still happening…
But I don’t why it parses a shortcode. This is data that is coming from a shortcode…Why the builder should parse this content? Why not only parse the content of the builder_template shortcode?
So this means this render function happens once the post_content is got. I don’t understand properly why you should parse tags for the post_content if in theory you only add dynamic data from the builder, not from the post content itself.
This also makes parse a lot of tags from a lot of shortcodes that use js…
And more… If some js code has “existent_tags”, because in their code uses something like
All the Bricks data is parsed by the Dynamic Data logic, including the output of the Post Content element.
With the current Bricks version the only possible workaround is to use the exclude tags filter and exclude the strings that are still in a conflict in the JS you want to use.
Here there is a solution:
I’ts simple: I use the “bricks/frontend/render_data” filter to first replace all scripts for some key and then, once the dynamic data is done, replace the key for the scripts again.
class Sal_bricksSkipScripts {
//array scripts with their unique keys
private $scriptsArray = [];
private $prefix = "###script###";
//function to replace the script for a script key
public function pre_render($content, $post ){
$pattern = "/\<script([^>]*)?\>.*?\<\/script\>/ims";
if(preg_match_all($pattern , $content, $matches)) {
foreach($matches[0] as $index => $script ) {
$key = $this->prefix . $index;
$this->scriptsArray[$key] = $script;
$content = str_replace($script, $key, $content );
}
}
return $content;
}
//function to replace script keys for the script
public function post_render($content, $post ){
if(!empty($this->scriptsArray)){
//substitute all matches
foreach($this->scriptsArray as $key => $script){
$content = str_replace($key, $script, $content );
}
//clean array
$this->scriptsArray = array();
}
return $content;
}
}
$fix = new Sal_bricksSkipScripts();
add_filter( 'bricks/frontend/render_data', [$fix, "pre_render"], 0, 2 );
add_filter( 'bricks/frontend/render_data', [$fix , "post_render"], 999999999, 2 );
We’re looking into this code conflict and we’ll add an improvement to the Dynamic Data logic to avoid conflicts with scripts and styles in a near future.