[SOLVED] SonataAdminBundle + WYSIWYG?

Discuss Symfony 2 bundles here

Moderators: dcobalt, tiagojsag

[SOLVED] SonataAdminBundle + WYSIWYG?

Postby zhil » Fri Sep 16, 2011 1:26 pm

Hi there!

I am trying to use some WYIWYG editor in SonataAdminBundle.

Can you please give me some suggestions about how I can do it in few words - becase I am kind of lost :)
Also posted such an issue in SonataAdminBundle github

Thanks
Last edited by zhil on Mon Sep 19, 2011 8:58 pm, edited 1 time in total.
User avatar
zhil
Senior Member
 
Posts: 143
Joined: Tue Sep 13, 2011 5:16 pm

Re: SonataAdminBundle + WYSIWYG?

Postby tiagojsag » Fri Sep 16, 2011 1:33 pm

Hi,

On your configureFormFields:
Code: Select all
      ->add('content', null, array('required' => false, 'attr' => array('class' => 'ckeditor')))


and add ckeditor js files to your project.

Piece of cake ;)
Tiago Garcia

Back End Developer @ Simbiotica
www.simbiotica.es
User avatar
tiagojsag
Faithful Member
 
Posts: 537
Joined: Wed Aug 10, 2011 4:58 pm

Re: SonataAdminBundle + WYSIWYG?

Postby zhil » Fri Sep 16, 2011 1:51 pm

Got you, thanks a lot :)
User avatar
zhil
Senior Member
 
Posts: 143
Joined: Tue Sep 13, 2011 5:16 pm

Re: [SOLVED] SonataAdminBundle + WYSIWYG?

Postby reggossi » Fri Mar 30, 2012 6:17 pm

Hi,

I might be missing something easy but I have tried this for now several hours and it still doesn't work.

The "content" field is no longer required (no star next to the label in the form) so the code in configureFormFields is taken into consideration. I've downloaded and extracted ckeditor in the js folder of my bundle and then I've published assets. Is there anything else to do ?

Since it doesn't work, I also tried to add :
Code: Select all
<script src="{{ asset('bundles/mybundle/js/ckeditor/ckeditor.js') }}" type="text/javascript"></script>

both in base.html.twig (in my bundle) and in standard_layout.html.twig (in sonataadminbundle) but it changes nothing. I guess the solution is easy but I can't figure it and I've found nothing elsewhere on the internet.

Thanks for your help
reggossi
Junior Member
 
Posts: 15
Joined: Thu Mar 22, 2012 9:20 pm

Re: [SOLVED] SonataAdminBundle + WYSIWYG?

Postby dcobalt » Fri Mar 30, 2012 7:39 pm

Are you actually calling the ckeditor on a selector somewhere in a JS file loaded by the admin?
I mean, something like
Code: Select all
$('textarea.whatever').ckeditor({ config options });

(or whatever the equivalent form for ckeditor is, I can't check the docs right now)

As far as I know, ckeditor doesn't do that by default. I might be wrong though, I use tinymce.
dcobalt
Faithful Member
 
Posts: 270
Joined: Thu Oct 20, 2011 6:06 pm

Re: [SOLVED] SonataAdminBundle + WYSIWYG?

Postby reggossi » Fri Mar 30, 2012 8:17 pm

Actually I have not written any other call to ckeditor elsewhere since by reading the previous posts I understood that this was enough.
I may however need to do it but I don't really know where this should be implemented.

Is tinymce easy to add to sonataadminbundle ? Because I might as well use it if this is simple.
(This only link I saw about tinymce and sonataadmin is : http://ideadapt.blogspot.fr/2012/01/cus ... fony2.html which made me think that it was a little bit tricky)
reggossi
Junior Member
 
Posts: 15
Joined: Thu Mar 22, 2012 9:20 pm

Re: [SOLVED] SonataAdminBundle + WYSIWYG?

Postby reggossi » Sat Mar 31, 2012 2:27 pm

The solution I've found (might be useful for someone else) : I've installed TrsteelCkeditorBundle and it works perfectly.
However, I still don't know the problem with the previous solution, but it's no longer important.
reggossi
Junior Member
 
Posts: 15
Joined: Thu Mar 22, 2012 9:20 pm


Return to Bundles discussion

Who is online

Users browsing this forum: No registered users and 2 guests