ACF Block template doesn't pass through blade render

I’m trying to use the new Gutenberg’s blocks with ACF. As the ACF docs suggests I’m using block.json to declare my blocks. I’m using it in /app/blocks/hero-slideshow/block.json

{
  "name": "acf/hero-slideshow",
  "title": "Hero Slideshow",
  "description": "Gallery fotografica",
  "category": "formatting",
  "icon": "admin-gallery",
  "keywords": ["hero-slideshow", "gallery"],
  "acf": {
    "mode": "preview",
    "renderTemplate": "/resources/views/blocks/hero-slideshow.blade.php"
  },
  "align": "full"
}

This works, but the template doesn’t render correctly. It’s plain PHP without blade. How can i handle this?

Hi @giannicash,

Out of the box, ACF won’t render blocks with Blade templates.

We use log1x/acf-composer to integrate Sage 10 with ACF, allowing us to use Blade templates in blocks.

With log1x/acf-composer installed, to create a block:

wp acorn acf:block Example

You’ll then find your Blade block view at resources/views/blocks/example.blade.php.

Hope that helps!

1 Like