By jaypabs on
I have added another content type called "Article". Now, I want to disable the wysiwyg api editor in the textarea of this content type.
Anyone know how to do this?
I have added another content type called "Article". Now, I want to disable the wysiwyg api editor in the textarea of this content type.
Anyone know how to do this?
Comments
When you're using the wysiwyg
When you're using the wysiwyg api, the wysiwyg is turned on or off depending on the input format. If you use it in conjunction with the Better Formats module (http://drupal.org/project/better_formats), there's a checkbox under input formats-> settings which allows you to fine tune which input format is the default for each node type. Then go to input formats -> defaults to choose input formats for each node type / user role combination.
Thanks for the module. I
Thanks for the module. I installed it but when I go to formats->defaults the role is applied for all nodes.
There's however a label in formats->defaults that says: These settings will be applied to all nodes and comments in the site unless overriden by specific content type defaults.
unless overridden by specific content type? Where can I override this?
_
Directly from the README.txt file included with better_formats:
Thank you
Thank you very much. I am looking for the readme file before and mis-look it.
Thanks again.
Download free source code
form_alter solution
I needed to remove wysiwyg from the comments field. I already had a custom module set up with a form_alter function, so I modified that.
I've posted more details and discussion on why I chose this method on my blog.
theme_comment_form solution
In a php file in my theme, I have a function for theme_comment_form to suppress some field titles from printing before their textareas. It looks something like this:
function theme_comment_form($form) {
$form['comment_filter']['format'] = array();
}
That seems to work okay so far.
There are a couple of minor
There are a couple of minor errors in your code:
comment-form should be comment_form and $form_id['comment_filter']['format'] = array(); should be $form['comment_filter']['format'] = array();
Actually, revnoah's solution
Actually, revnoah's solution worked for me, whereas this one did not.
Dangerous
I can not emphesize this good enough, but this hack might cause your comments to be highly sensitive to XSS (Cross-site scripting) since this hack removes formatting from your comment field. Especially for anonymous users, this content should be filtered against dangerous input like Javascript, HTML and any other possible dangers from entering your website.
I highly recommend using the better_formats module to fix this issue. Else, be at least sure enough that your formatting defaults are set correctly and filter malicious code.
I know this is an old topic, but for the sake of Googling people, this must be noted.
[solved] But Don't disable the filters
Ambidex is correct. Disabling the filters (filter.module) not only disables the wysiwyg but also the text filtering, which means that users can enter whatever they want, and can potentially open you up to user input attacks.
If your are using the wysiwyg module then you have another alternative:
First, here is a description of how wysiwyg gets the editor in place:
OK now the magic:
In the wysiwyg.module after_build processor is the following code:
function wysiwyg_process_form( &$form ) (version as of today)
wysiwyg.module:134
This means that any element that would have an editor attached (the textareas) can have the wysiwyg editor disabled, if it has a #wysiwyg=false attribute in the form array.
That meaning that for the comment form, in any drupal module hook_form_alter, you can put this:
Note that the if condition is for the form api version that I am using (I notice that some comments above are using a different formAPI.) All you really have to do is find your textarea, and add the #wysiwyg=false attribtue to it.
Note that this solution still allows filter selection as they were before the modification, and doesn't hide the format selector. You could technically hide that with CSS, and really you should modify filtering priveleges at role and node-type levels.
Another good source of the
Another good source of the same two solutions:
http://www.only10types.com/2011/12/drupal-6-enabledisable-wysiwyg-editor...
This is in the D7 versions of the wysiwyg module already.
So don't use the first snippet...
But you have to set the ['#wysiwyg'] = FALSE directly on whatever element is of type 'text_format', that is, a text area with textformats enabled. This means drilling down into the array, unfortunately..
This would work to eliminate wysiwyg on comment body in a hook_form_comment_form_alter for instance: