简体   繁体   English

Drupal 6:在自定义模块表单上实现Wysiwyg

[英]Drupal 6: Implement Wysiwyg on Custom Module Form

I have a custom form that I have written with the Form API. 我有一个自定义表单,我用Form API编写。 We have the WYSIWYG module and TinyMCE implemented on the site that this module will be used on. 我们在网站上实现了WYSIWYG模块和TinyMCE,将使用该模块。 How do I implement the WYSIWYG api on my custom form text areas? 如何在自定义表单文本区域上实现WYSIWYG api?

Thanks! 谢谢!

This should help integrate WYSIWYG with your custom module forms: http://drupal.org/node/358316 这应该有助于将WYSIWYG与您的自定义模块表单集成: http//drupal.org/node/358316

Basically, you need to add the format key to each of your form fields and use filter_form() 基本上,您需要将format键添加到每个表单域并使用filter_form()

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 以防任何人使用Drupal 7,这里的链接应该有助于将WYSIWYG TinyMCE与您的自定义表单字段集成: http//drupal.org/node/1087468

Thanks 谢谢

In case you are working in drupal 7. Use the following. 如果你在drupal 7工作。使用以下。

$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'];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM