diff --git a/Resources/config/service.xml b/Resources/config/service.xml index 1bf7cf5a..5ecbce11 100644 --- a/Resources/config/service.xml +++ b/Resources/config/service.xml @@ -12,6 +12,7 @@ + diff --git a/Twig/Extension/StfalconTinymceExtension.php b/Twig/Extension/StfalconTinymceExtension.php index 3f99ca1f..17d28ab7 100644 --- a/Twig/Extension/StfalconTinymceExtension.php +++ b/Twig/Extension/StfalconTinymceExtension.php @@ -2,6 +2,7 @@ namespace Stfalcon\Bundle\TinymceBundle\Twig\Extension; use Stfalcon\Bundle\TinymceBundle\Helper\LocaleHelper; +use Symfony\Component\Asset\Packages; use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -25,14 +26,20 @@ class StfalconTinymceExtension extends \Twig_Extension */ protected $baseUrl; + /** + * @var Packages + */ + private $packages; + /** * Initialize tinymce helper * * @param ContainerInterface $container */ - public function __construct(ContainerInterface $container) + public function __construct(ContainerInterface $container, Packages $packages) { $this->container = $container; + $this->packages = $packages; } /** @@ -94,7 +101,7 @@ public function tinymceInit($options = array()) unset($config['asset_package_name']); /** @var $assets \Symfony\Component\Templating\Helper\CoreAssetsHelper */ - $assets = $this->getService('assets.packages'); + $assets = $this->packages; // Get path to tinymce script for the jQuery version of the editor if ($config['tinymce_jquery']) { @@ -180,7 +187,7 @@ public function tinymceInit($options = array()) json_encode($config) ); - return $this->getService('templating')->render('StfalconTinymceBundle:Script:init.html.twig', array( + return $this->getService('twig')->render('@StfalconTinymce/Script/init.html.twig', array( 'tinymce_config' => $tinymceConfiguration, 'include_jquery' => $config['include_jquery'], 'tinymce_jquery' => $config['tinymce_jquery'], @@ -208,8 +215,7 @@ public function getName() */ protected function getAssetsUrl($inputUrl) { - /** @var $assets \Symfony\Component\Templating\Helper\CoreAssetsHelper */ - $assets = $this->getService('assets.packages'); + $assets = $this->packages; $url = preg_replace('/^asset\[(.+)\]$/i', '$1', $inputUrl); diff --git a/composer.json b/composer.json index 8fcca1ab..b730e1ec 100644 --- a/composer.json +++ b/composer.json @@ -26,7 +26,9 @@ }, "require": { "php": ">=5.4.0", - "symfony/symfony": ">=3.0" + "symfony/framework-bundle": ">=3.0", + "symfony/twig-bundle": ">=3.0", + "symfony/asset":">=3.0" }, "autoload": { "psr-0": {