# Creating an ACF Block using a Blade template

**URL:** https://discourse.roots.io/t/creating-an-acf-block-using-a-blade-template/28875
**Category:** sage
**Tags:** sage9
**Created:** 2024-11-04T17:16:32Z
**Posts:** 4

## Post 1 by @tm2024 — 2024-11-04T17:16:33Z

Hi,

I’ve been trying to create an ACF Block that renders a Blade template following [this](https://discourse.roots.io/t/register-an-acf-block-with-modern-practices/25887) discussion as a guide, using the `renderCallback` approach because I’m aware that `acf_register_block_type()` is deprecated. However, I’m running into an issue where no parameters are being passed into my callback function. My codebase looks something like this:

`resources/views/blocks/new-block/block.json`:

```
...
"acf": {
    "mode": "auto",
    "renderCallback": "\\App\\blade_render_callback",
    "postTypes": ["page"],
    "blockVersion": 2
},
...
```

`resources/views/blocks/new-block/new-block.blade.php`:

```
<p>Hello world</p>
```

`app/controllers/App.php`:

```
public function blade_render_callback($block, string $content = '', bool $is_preview = false, int $post_id = 0, array $wp_block = [], array $context = [])
    {
        echo \Roots\view('blocks/new-block')->render();
    }
```

This throws an error where the `blade_render_callback()` expects at least 1 argument to be passed, but receives 0. If I change my controller function to provide a default value of an empty array for `$block`, I get a different error in `vendor/roots/acorn/src/Roots/helpers.php` due to a call to an undefined function `app()` on line 73.

Any advice on how to fix this issue would be greatly appreciated.

Thanks! :slight_smile:

---

## Post 2 by @RistoKaalma — 2024-11-05T15:35:12Z

I’d suggest looking into [log1x/acf-composer](https://github.com/Log1x/acf-composer)

---

## Post 3 by @tm2024 — 2024-11-06T12:45:53Z

This seems like it could be incredibly useful, although at the minute I’m using Sage 9 and acf-composer looks like it only works with Sage 10 and above. Any ideas on how I can get my current approach working (I’d like to avoid the time investment in updating to Sage 10 if possible), or is `renderCallback` not working as expected a known issue?

---

## Post 4 by @RistoKaalma — 2024-12-05T15:58:46Z

I’ve mostly used `log1x/acf-composer` myself so I can’t share any good alternatives at this point.
