Disable tinymce for fields in drupal module: webform

Submitted by charles on
I normally disable tinymce for certain textareas by overriding the tinymce function theme_tinymce_theme. This allows me to target textareas by their name attribute. For example, to disable the editor for all cck fields that I have named 'description', and all the devel modules 'php code' block textareas, one would put the following in that function: function phptemplate_tinymce_theme($init, $textarea_name, $theme_name, $is_running) { switch ($textarea_name) { // Disable tinymce for these textareas - using the field's name attribute case 'field-description-0-value': // cck description field case 'code': // php code from devel module unset($init); break; default: return theme_tinymce_theme($init, $textarea_name, $theme_name, $is_running); } // Always return $init return $init; } I ran into a problem with drupal's webform module, in that I couldn't figure out how to target a field I'd created called 'comments'. When I looked at the form source code, I saw the name attribute of the textarea field was: submitted['comments']. Putting this in the above function did not work. To find out what the textarea name was, I placed a print statement at the beginning of the function so I could see what textarea name was being passed to the function: function phptemplate_tinymce_theme($init, $textarea_name, $theme_name, $is_running) { print " TEXTAREA NAME: $textarea_name"; This gave me the name "submitted-comments" for the abovementioned webform textarea, which then allowed me to add the following case to the switch statement: case 'submitted-comments': // my webform comments and tinymce disappeared...