stfalcon / TinymceBundle

Bundle for connecting TinyMCE (WYSIWYG editor) to your Symfony2 project
259 stars 154 forks source link

Upgrade for Symfony3 #175

Closed manuelDistefano closed 8 years ago

manuelDistefano commented 8 years ago

Please can you upgrade the bundle for Symfony3?

At the moment, in StfalconTinymceExtension, you use 2 services not available in Symfony 3.0:

 1) "templating.helper.assets" You can use "assets.packages" instead;
 2) "request" for "request->getLocale()" method. You can use getParameter('locale')

Best regards,

Manuel

LogansUA commented 8 years ago

@manuelDistefano Hello. Yes, I'll do it in few days. :smile:

manuelDistefano commented 8 years ago

Hi,

thank you very much

LogansUA commented 8 years ago

@manuelDistefano or, maybe you have inspiration to do this fix?

manuelDistefano commented 8 years ago

Yeah,

the only class you need to change is
Stfalcon\Bundle\TinymceBundle\Twig\Extension\StfalconTinymceExtension

You need to use "assets.packages" service instead of "templating.helper.assets" for getUrl(). Reference: https://raw.githubusercontent.com/symfony/symfony/master/UPGRADE-3.0.md

Plus, "request" service for getLocale isn't available anymore. You can container->getParameter('locale')

So, you need to change line: 93) $assets = $this->getService('assets.packages'); 205) $assets = $this->getService('assets.packages'); 126) $config['language'] = $this->getParameter('locale');

I'm testing it with default configuration and it work.

LogansUA commented 8 years ago

@manuelDistefano $this->getParameter('locale'); return locale from config.yml, but not from request.

Maybe better way to initialize new $request variable in __construct with $container->get('request'); and use it like that $config['language'] = $this->request->getParameter('locale');

manuelDistefano commented 8 years ago

@LogansUA My mistake. You cant use $container->get('request') because this service dont exist anymore. You need to user 'request_stak' $this->container->get('request_stack')->getCurrentRequest()->getLocale()

Sorry for bad english :)

LogansUA commented 8 years ago

Closing. Fixed by #176