WYSIWIG Field in Admin Settings form

Public

Add a WYSIWYG form field to a custom admin settings form

Get raw version
php
  1. <?php
  2. function MYMODULE_admin_form($form, &$form_state) {
  3. $saved_setting = variable_get('MYMODULE_setting_element',array());
  4. $form['MYMODULE_setting_element'] = array(
  5. '#type' => 'text_format',
  6. '#title' => t('WYSIWYG Field'),
  7. '#default_value' => isset($saved_setting['value'])? $saved_setting['value'] : '',
  8. '#format' => !empty($saved_setting['format'])? $saved_setting['format'] : NULL,
  9. );
  10.  
  11. return system_settings_form($form);
  12. }