texarea 中用于 Drupal 配置表单的所见即所得编辑器
是否可以在 texarea 中使用所见即所得编辑器 用于 Drupal 站点配置表单 (system_settings_form)。
这就是现在配置的编码方式......
$form['my_module_text_bottom'] = array(
'#type' => 'textarea',
'#title' => t('Some text'),
'#default_value' => variable_get('my_module_text_bottom', 'This is configurable text found in the module configuration.'),
'#size' => 1024,
'#maxlength' => 1024,
'#description' => t("Some text."),
'#required' => TRUE,
);
return system_settings_form($form);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
这里是 Drupal 7 和 Drupal 6。
对于 D7:
对于 D6:
Here it is for Drupal 7 and Drupal 6.
For D7:
For D6:
我一直在寻找这个问题大约 6 个小时,最后我找到了原因,对于您的自定义文本区域字段,您必须添加此行,以使用默认输入格式(完整 HTML):
$form['format'] = filter_form() ;
请注意,如果您在字段集中使用此表单元素,则必须包含此字段集:
$form['donation-instructions']['format'] = filter_form();
我希望这会帮助你
I kept searching for this issue for about 6 hours and finally i found the reason, for your custom textarea field you must add this line, to use the default input format (Full HTML):
$form['format'] = filter_form();
be careful if you use this form element inside fieldset you must include this fieldset:
$form['donation-instructions']['format'] = filter_form();
I hope this will help you
WYSIWYG 或 CKEditor 模块应该能够做到这一点。
The WYSIWYG or CKEditor modules should be able to do this.
我发现这个问题类似于:
Drupal 6: Implement Wysiwyg on Custom Module Form
那里的答案之一指向这个 drupal.org 页面:
http://drupal.org/node /358316
它提供了“format”数组键和filter_form()的相当详细的示例,还描述了如果您的表单有多个文本区域,它是如何使用的。
那里给出的方法不适用于 Drupal 7。
我遇到了类似的情况,我下载并安装了 CKEditor,它在编辑内容节点时显示,但在我的配置表单上没有显示文本区域模块。
I found this question similar to:
Drupal 6: Implement Wysiwyg on Custom Module Form
One of the answers there pointed to this drupal.org page:
http://drupal.org/node/358316
which provides fairly detailed examples of the "format" array key and filter_form(), also describing how it's used if your form has multiple textareas.
The approach given there doesn't apply to Drupal 7.
I ran into a similar situation where I'd downloaded and installed and installed CKEditor and it displayed when editing content nodes, but didn't display for the textarea on a configuration form for my module.