下面的方法 应该是好的
<?php
function my_module_form_alter($form_id, &$form) {
if ($form_id['#id'] == 'comment_form') {
$form['comment_filter']['format'] = array();
}
}
?>
来自 https://drupal.org/node/424164
禁用富文本编辑器 下面是好像不行
function shipingzhongcustomtwo_form_alter(&$form, &$form_state, $form_id){
global $language;
if ($form_id == 'comment_form') {
//unset($form['subject']); //去掉title 标题
//unset($form['preview']); //去掉preview 预览
$form['comment_filter']['comment']['#cols'] = 110;
$form['comment_filter']['comment']['#rows'] = 8;
}
$form['comment_filter']['comment']['#wysiwyg'] = FALSE;
}
There's a solution here http://www.only10types.com/2011/12/drupal-6-enabledisable-wysiwyg-editor.html
Basically, you need to alter this specific edit form. This is what I did for Drupal 7 (the blog post is for Drupal 6):
function MYMODULE_form_alter(&$form, &$form_state, $form_id) {
// Workaround to disable Wysiwyg just in this field.
if ($form_id === 'FORM_ID_OF_EDIT_FORM') {
$form['field_CUSTOM'][LANGUAGE_NONE][0]['#wysiwyg'] = FALSE;
}
}
You may want to use $language->language instead of LANGUAGE_NONE.
来自 http://drupal.stackexchange.com/questions/66093/disable-rich-text-editor-by-default
New form method
function mymodule_settings_form() { $form['foobar'] = array( '#type' => 'textarea', '#title' => t('foobar'), '#default_value' => "foobar", '#required' => FALSE, '#wysiwyg' => FALSE, ); return system_settings_form($form); }
form alter method
function mymodule_form_alter(&$form, &$form_state, $form_id) { if ($form_id == 'mymodule_settings_form') { $form['foobar']['#wysiwyg'] = FALSE; } } 来自 http://janaksingh.com/blog/drupal-6-disable-ck-editor-wysiwyg-programmatically-138