WYSIWYG not only for node form

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
alpixel's picture

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

albertczyk's picture

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

Rickdrummer's picture

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

albertczyk's picture

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.

Wysiwyg

Group organizers

Group categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week