Posted By

jonathanpglick on 06/22/10


Tagged


Versions (?)

Trigger WYSIWYG editor in Drupal Form API


 / Published in: PHP
 

URL: http://api.drupal.org/api/function/filter_form/6

The trick is having a "format" key for the textarea and using filter_form().

Use two elements with the same parent; the textarea element and an element with the "format" key. (important!).

Example below.

  1. $form['some_wrapper'] = array(
  2. '#tree' => TRUE,
  3. 'text' => array(
  4. '#title' => 'Text',
  5. '#type' => 'textarea',
  6. '#default_value' => 'Default Text',
  7. ),
  8. 'format' => filter_form($value = FILTER_FORMAT_DEFAULT, NULL, array('format'))
  9. );

Report this snippet  

You need to login to post a comment.