multiple TinyMCE editors with sfWidgetFormTextareaTinyMCE
I noticed the other day that when using the sfWidgetFormTextareaTinyMCE widget which is part of the sfFormExtraPlugin plugin, it wouldnt display more than 1 editor on a page. After looking at the class and comparing the javascript to the javascript that was generated by the old textarea_tag() function I noticed a few differences.
To fix this, copy \plugins\sfFormExtraPlugin\lib\widget\sfWidgetFormTextareaTinyMCE.class.php to \lib\widgets\ and make the following change to the javascript:
<script type="text/javascript"> tinyMCE.init({ mode: "exact", theme: "%s", elements: "%s", %s %s theme_advanced_toolbar_location: "top", theme_advanced_toolbar_align: "left", theme_advanced_statusbar_location: "bottom", theme_advanced_resizing: true %s }); </script>
You will probably have to create the \lib\widget directory. Dont forget to clear your cache.




hi, I’ve found another, simpler solution (as it doesn’t need to create a new widget). Simple set the class attribute to the widget:
$this->widgetSchema['fr_FR']['text'] = new sfWidgetFormTextareaTinyMCE(array(
‘width’ => 550,
‘height’ => 350,
‘config’ => ‘theme_advanced_disable: “anchor,image,cleanup,help”‘,
),
array(
‘class’ => ‘tiny_mce’
)
);
$this->widgetSchema['en_GB']['text'] = new sfWidgetFormTextareaTinyMCE(array(
‘width’ => 550,
‘height’ => 350,
‘config’ => ‘theme_advanced_disable: “anchor,image,cleanup,help”‘,
),
array(
‘class’ => ‘tiny_mce2′
)
);
Note that it requires the class value to be unique in the css class names.
Maybe the widget have to be changed to use the TinyMCE mode: ‘exact’ and allow to set the element parameter instead of the editor_selector (class value is used here)
Muchas gracias
Hey,
I have better solution:
simply add in options array:
‘configure’ => ‘elements: description_2′