Skip to content

Instantly share code, notes, and snippets.

@boonkerz
Created July 8, 2012 22:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save boonkerz/3073222 to your computer and use it in GitHub Desktop.
Save boonkerz/3073222 to your computer and use it in GitHub Desktop.
<?php
namespace TaKeTV\PortalBundle\Twig;
use CCDNComponent\CommonBundle\Manager\ManagerInterface;
use Symfony\Component\DependencyInjection;
class SiteExtension extends \Twig_Extension
{
private $serviceContainer = false;
public function __construct($serviceContainer) {
$this->serviceContainer = $serviceContainer;
}
public function getGlobals()
{
return array('site' => $this->site());
}
public function site()
{
return $this->serviceContainer->get('taketv.site.manager')->getSite();
}
public function getName()
{
return 'site';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment