ACF block blade template

Hi. I have my blade template for my ACF block:


The acf_register_block_type function has the template path. It works:

'render_template' => 'app/themes/sage/resources/views/blocks/my-block.blade.php',

But none of blade markup inside this template is rendered in the front. I mean, this:

@if (true)

is rendered literally:

Captura de pantalla 2022-08-06 a las 20.05.47

Normal PHP, like this, works:

<?php echo get_field('my_block_field'); ?>

How can I make the templates transpile the blade markup? it’s possible?

You might look into ACF Composer or Poet for managing the Blade views for ACF blocks.

They take care of the rendering of the blade view instead of just rendering it as php which is I think the default from ACF.

1 Like