Code snippets for symfony 1.x


Retrieving action variables in a component

Used in a component action, the following code can be used to get the variables set in a module action that has used the component in its view:

$actionStack = $this->context->getActionStack();
$variables = $actionStack->getFirstEntry()->getActionInstance()->getVarHolder();

then you can use

$foo = $variables->get("foo");

to retrieve a variable. Note that the above is for the most recent action only.

by Rich Sage on 2009-10-01, tagged action  component  variables