Skip to content

Instantly share code, notes, and snippets.

@ideadapt
Created January 17, 2012 14:50
Show Gist options
  • Save ideadapt/1626913 to your computer and use it in GitHub Desktop.
Save ideadapt/1626913 to your computer and use it in GitHub Desktop.
add tinymce to form field in symfony2
$formMapper
->with('General')
->add('title')
->add('blog', 'textarea', array('attr' => array('class' => 'tinymce', 'tinymce'=>'{"theme":"simple"}')))
@Sergic
Copy link

Sergic commented Feb 2, 2012

no problem with quotes and i use latest version of sonata bundle
it simply does not return css class in array.
i wrote array(‘attr’ => array(‘class’ => ‘tinymce’));
nothing (((
only return class="sonata-medium"
i don't know what to do

@Sergic
Copy link

Sergic commented Feb 2, 2012

found class
vendor\bundles\Sonata\AdminBundle\Form\Extension\Field\Type\FormTypeFieldExtension.php
string 110 $attr = $view->get('attr', array());
this class does not get attr param from formMapper why? and how to debug it....

@ideadapt
Copy link
Author

ideadapt commented Feb 2, 2012

To debug you can write to a logger and check the logfile after the request. See http://symfony.com/doc/current/cookbook/logging/monolog.html. Or you could debug your php code using xdebug ...
I have the FormTypeFieldExtension.php file too, with the same content as you do. I didnt change it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment