Drupal 6 tinymce: Disable tinymce on textarea (how to overide theme_tinymce_theme() function)

Posted by: 
Dominique De Cooman

It's impossible to override this function.
Why? Look at the functions name. It confusses drupal thinking its an implementation of hook_theme(). So any override in template.php using phptemplate_tiny_mce() or theme_name_tinymce_theme() wont work.
You need to patch the module.
If you want to add a text area that doesnt need tinymce just add an other rule shown by the id of 'my-textarea'.

 * Customize a TinyMCE theme.
 * @param init
 *   An array of settings TinyMCE should invoke a theme. You may override any
 *   of the TinyMCE settings. Details here:
 *    <a href="http://tinymce.moxiecode.com/wrapper.php?url=tinymce/docs/using.htm
</a> *
 * @param textarea_name
 *   The name of the textarea TinyMCE wants to enable.
 * @param theme_name
 *   The default tinymce theme name to be enabled for this textarea. The
 *   sitewide default is 'simple', but the user may also override this.
 * @param is_running
 *   A boolean flag that identifies id TinyMCE is currently running for this
 *   request life cycle. It can be ignored.
function theme_tinymce_theme($init$textarea_name$theme_name$is_running) {
// uncomment to debug this
/*   print_r($init);
switch ($textarea_name) {
// Disable tinymce for these textareas
case 'log'// book and page log
case 'img_assist_pages':
'caption'// signature
case 'pages':
'access_pages'//TinyMCE profile settings.
case 'user_mail_welcome_body'// user config settings
case 'user_mail_approval_body'// user config settings
case 'user_mail_pass_body'// user config settings
case 'synonyms'// taxonomy terms
case 'description'// taxonomy terms
    //add your rule here 
case 'my-textarea':


// Force the 'simple' theme for some of the smaller textareas.
case 'signature':
$init['theme'] = 'simple';
      foreach (
$init as $k => $v) {
        if (
strstr($k'theme_advanced_')) unset($init[$k]);

/* Example, add some extra features when using the advanced theme.

  // If $init is available, we can extend it
  if (isset($init)) {
    switch ($theme_name) {
     case 'advanced':
       $init['extended_valid_elements'] = array('a[href|target|name|title|onclick]');


  // Always return $init
return $init;

Add new comment

Who are you?

By knowing who you are you will be directed to a page where we have displayed all our drupal services relevant to your professional identity.