2 // src/Rapsys/PackBundle/Twig/PackExtension.php
3 namespace Rapsys\PackBundle\Twig
;
5 use Symfony\Component\HttpKernel\Config\FileLocator
;
6 use Symfony\Component\DependencyInjection\ContainerInterface
;
7 use Symfony\Component\Asset\Packages
;
9 class PackExtension
extends \Twig_Extension
{
19 public function __construct(FileLocator
$fileLocator, ContainerInterface
$containerInterface, Packages
$assetsPackages) {
21 $this->fileLocator
= $fileLocator;
22 //Set container interface
23 $this->containerInterface
= $containerInterface;
25 $this->assetsPackages
= $assetsPackages;
27 //Retrieve bundle config
28 if ($parameters = $containerInterface->getParameter($this->getAlias())) {
29 foreach($parameters as $k => $v) {
35 public function getTokenParsers() {
37 new PackTokenParser($this->fileLocator
, $this->assetsPackages
, $this->config
, 'stylesheet', $this->output
['css'], $this->filters
['css']),
38 new PackTokenParser($this->fileLocator
, $this->assetsPackages
, $this->config
, 'javascript', $this->output
['js'], $this->filters
['js']),
39 new PackTokenParser($this->fileLocator
, $this->assetsPackages
, $this->config
, 'image', $this->output
['img'], $this->filters
['img'])
46 public function getAlias() {