Created
July 15, 2012 10:31
-
-
Save mpiecko/3116204 to your computer and use it in GitHub Desktop.
Using boot() to add global variables in Twig
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace My\BackendBundle; | |
use Symfony\Component\HttpKernel\Bundle\Bundle; | |
class BackendBundle extends Bundle | |
{ | |
public function boot() | |
{ | |
$twig = $this->container->get('twig'); | |
$twig->addGlobal('backend', array( | |
'title' => $this->container->getParameter('backend.title') | |
)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment