I’m using mwdelaney/sage-acf-gutenberg-blocks to create my custom ACF Gutenberg blocks. In this case, I have a custom Gutenberg block that is included on the front page.
In the markup of my block I would like to access some logic that is defined in a Sage controller. But neither the variables declared in the app controller nor the ones in the home controller are accessible.
// in app/Controllers/App.php
public function test()
{
return 'hello world from App controller';
}
// in app/Controllers/FrontPage.php
public function test2()
{
return 'hello world from FrontPage controller';
}
I would expect this to work:
// in my ACF Custom Gutenberg Block code
{{ $test }}
{{ $test2 }}
But instead I’m getting undefined variable
errors.
Is there a way to make this work? Other than moving my logic to the block code?