Return to Snippet

Revision: 27731
at June 22, 2010 07:08 by jonathanpglick


Initial Code
$form['some_wrapper'] = array(
  '#tree' => TRUE,
  'text' => array(
    '#title' => 'Text',
    '#type' => 'textarea',
    '#default_value' => 'Default Text',
  ),
  'format' => filter_form($value = FILTER_FORMAT_DEFAULT, NULL, array('format'))
);

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

Initial Description
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.

Initial Title
Trigger WYSIWYG editor in Drupal Form API

Initial Tags


Initial Language
PHP