I want to plug twig into an application that would need some session-based data incorporated in the base. For example, the client's current timezone shows in the footer. It doesn't make sense for the individual controllers to know about this, since it has nothing to do with them; but on the other hand, they select and populate the view:
class MyController
{
public function index()
{
$template = $this->twig->loadTemplate('myPageTemplate.html.twig');
return $template->render($dataArray);
}
}
Is there some well-formed way to pass a data object to twig before you select a view, and make that available to the base template? Something that you would do upon firing up the Twig_Environment and passing it in?