Hello,
Thanks for the feedback, and sorry for the late answer, I’m kinda busy with the upcoming patch lately.
I’m not a user of Blade, so I don’t really know how it works. Supposing Blade has its own function to blade_include()
files, you could hook in the Flexible Content Dynamic Render to disallow the native include()
function, and just use your own function instead.
Here is a usage example:
add_filter('acfe/flexible/render/template/name=my_flexible_content', 'my_flexible_content_render_file', 10, 4);
function my_flexible_content_render_file($file, $field, $layout, $is_preview){
// disallow the native Dynamic Render include()
// this tells ACFE that PHP files set in each layout settings do not exist
// which prevents the include() usage
return false;
}
add_action('acfe/flexible/render/before_template/name=my_flexible_content', 'my_flexible_content_render', 10, 3);
function my_flexible_content_render($field, $layout, $is_preview){
// get PHP file path set in the layout setting UI
$file = acf_maybe_get($layout, 'acfe_flexible_render_template');
if(!empty($file)){
// locate the file in theme
// $file_path = get_stylesheet_directory() . '/' . $file;
// use blade php include here
// ...
}
}
You’ll find the acfe/flexible/render/template
documenation here, and the acfe/flexible/render/before_template
documentation here.
Hope it helps!
Have a nice day!
Regards.