Posted by alpixel on November 5, 2010 at 4:42pm
For some reasons, i needed to enable a wysiwyg on some system pages which are not handled by the plugin like :
- site information
- block configuration
Does anyone know how to do that on a 6.X Drupal ? I searched a lot but can't figure out how to do that.
Comments
Me too
This was very easy with the old TinyMCE plugin in D5; you'd just define in a theme function the css id's for the textareas where you want to have TinyMCE enabled, and voilá. But the closer I've got to achieving the same with wysiwyg module is just to display an input format chooser - and not where I wanted, as per http://drupal.org/node/357080
I think this is an important issue, as wysiwyg 'de facto' is only applicable to node body and comments.
So, there is no way for
So, there is no way for adding tinymce+wysiwyg on custom textarea created with form api? I've already spent 3 hours to figure it out, but still there is no success :(
Solved
Yes, in fact I've found the answer by looking at the comment module. I had noticed that it was possible to choose input format for comments, and when Full/filtered HTML was selected, the WYSIWYG editor kicked in. Here is the related code:
$form['comment_filter']['comment'] = array(
'#type' => 'textarea',
'#title' => t('Comment'),
'#rows' => 15,
'#default_value' => $default,
'#required' => TRUE,
);
if (!isset($edit['format'])) {
$edit['format'] = FILTER_FORMAT_DEFAULT;
}
$form['comment_filter']['format'] = filter_form($edit['format']);
So, you define an array with two elements, one of which is the textarea itself, and the other one the format chooser generated by filter_form, and that's all.