Drupal 6: Implement Wysiwyg on Custom Module Form

折月煮酒 提交于 2019-12-10 20:44:06

问题


I have a custom form that I have written with the Form API. We have the WYSIWYG module and TinyMCE implemented on the site that this module will be used on. How do I implement the WYSIWYG api on my custom form text areas?

Thanks!


回答1:


This should help integrate WYSIWYG with your custom module forms: http://drupal.org/node/358316

Basically, you need to add the format key to each of your form fields and use filter_form()




回答2:


Just in case anybody working with Drupal 7, here's the link to it that should help integrate WYSIWYG TinyMCE with your custom form fields: http://drupal.org/node/1087468

Thanks




回答3:


In case you are working in drupal 7. Use the following.

$form['FIELD'] = array(
  '#type' => 'text_format',
  '#title' => t('TITLE'),
  '#format' => 'full_html' //the format you used for editor.
);

In your form submit handler, you can access the value as follows.

$form_state['values']['FIELD']['value'];


来源:https://stackoverflow.com/questions/5353649/drupal-6-implement-wysiwyg-on-custom-module-form

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!