|
@@ -11,19 +11,22 @@
|
|
|
|
|
|
namespace Symfony\Bundle\TwigBundle\Extension;
|
|
|
|
|
|
-use Symfony\Component\DependencyInjection\ContainerInterface;
|
|
|
+use Symfony\Bundle\FrameworkBundle\Templating\Helper\AssetsHelper;
|
|
|
|
|
|
/**
|
|
|
- *
|
|
|
* @author Fabien Potencier <fabien@symfony.com>
|
|
|
+ * @author Alexandre Salomé <alexandre.salome@gmail.com>
|
|
|
*/
|
|
|
-class TemplatingExtension extends \Twig_Extension
|
|
|
+class AssetsExtension extends \Twig_Extension
|
|
|
{
|
|
|
- protected $container;
|
|
|
+ /**
|
|
|
+ * @var Symfony\Bundle\FrameworkBundle\Templating\Helper\AssetsHelper
|
|
|
+ */
|
|
|
+ private $helper;
|
|
|
|
|
|
- public function __construct(ContainerInterface $container)
|
|
|
+ public function __construct(AssetsHelper $helper)
|
|
|
{
|
|
|
- $this->container = $container;
|
|
|
+ $this->helper = $helper;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -51,7 +54,7 @@ class TemplatingExtension extends \Twig_Extension
|
|
|
*/
|
|
|
public function getAssetUrl($path, $packageName = null)
|
|
|
{
|
|
|
- return $this->container->get('templating.helper.assets')->getUrl($path, $packageName);
|
|
|
+ return $this->helper->getUrl($path, $packageName);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -62,7 +65,7 @@ class TemplatingExtension extends \Twig_Extension
|
|
|
*/
|
|
|
public function getAssetsVersion($packageName = null)
|
|
|
{
|
|
|
- return $this->container->get('templating.helper.assets')->getVersion($packageName);
|
|
|
+ return $this->helper->getVersion($packageName);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -72,6 +75,6 @@ class TemplatingExtension extends \Twig_Extension
|
|
|
*/
|
|
|
public function getName()
|
|
|
{
|
|
|
- return 'templating';
|
|
|
+ return 'assets';
|
|
|
}
|
|
|
}
|