# Sage 10, Composer controller on ACF block

**URL:** https://discourse.roots.io/t/sage-10-composer-controller-on-acf-block/20840
**Category:** sage
**Tags:** composer, sage10
**Created:** 2021-05-26T08:16:46Z
**Posts:** 2

## Post 1 by @Bollas — 2021-05-26T08:16:46Z

Hello,  
I’m trying to create a composer controller on a ACF block, this is the code

**resources/views/blocks/latest-news.blade.php**  
{{–  
Title: Latest news  
Description: Latest news Block  
Category: formatting  
Icon: wordpress  
Keywords: news  
Mode: edit  
–}}

`@php var_dump($test); @endphp`

**app/View/Composers/Blocks/LatestNews.php**

```
namespace App\View\Composer\Blocks;
use Roots\Acorn\View\Composer\Blocks;
 
class LatestNews extends Composer
{  
    /**
     * List of views served by this composer.
     *
     * @var array
     */ 
    protected static $views = [ 
        'blocks.latest-news', 
    ];
 
    public function with()
    {  
        return ['test' => 'Hello'];
    }  
}
```

but I get an error that $test has not been declared so it seems that it does not enter the LatestNews class.  
Do you see something wrong?

---

## Post 2 by @theMosaad — 2021-05-26T09:35:06Z

[acf-composer](https://github.com/Log1x/acf-composer#generating-a-block) should make your life easier.

---

## Post 3 by @system — 2021-07-07T08:16:47Z

This topic was automatically closed after 42 days. New replies are no longer allowed.
