This is my first SymfonyCMF application, so please bear with me, I might be fundamentally misunderstanding some concepts.
I have an ActionBlock (/cms/content/most-recent-psa
) with an action of FooCmsBundle:Psa:embedPsa
.
My embed function looks like this:
class PsaController extends Controller {
/**
* @Template()
*/
public function embedPsaAction() {
//... figure out which PSA needs to be displayed and set it to $psa
return array('page' => $psa);
}
}
I embed it in a Twig template with this: {{ sonata_block_render({"name": "/cms/content/most-recent-psa"}) }}
When I embed that template on a page, I get this exception: Variable "psa" does not exist in /var/www/peacefund-cms/src/Foo/CmsBundle/Resources/views/Psa/embedPsa.html.twig at line 6
, which is just a simple output: <h2>{{ psa.title | raw }}</h2>
.
So it looks like it's doing everything correctly. I've made sure that $psa is a valid value when it gets returned from the embedPsaAction
function, and it seems like it loads the template exactly as it should, but the variable isn't being exposed.