Disable TinyMCE for webforms

Last modified: April 9, 2008 - 20:40

TinyMCE uses the same 'use php for block visibility' system as blocks, so I thought I'd re-post this here in case anyone needs it.

I wanted to keep tinymce from showing up in the editing pages for webforms, but still have it show up for all other node types, including comments. Here's some code to go in the "Show if the following PHP code returns TRUE (PHP-mode, experts only)" area of the tinymce settings for a given profile. (For variations, see http://drupal.org/node/72940).

<?php
    $match
= false;
   
$blacklist = array('webform');
  
   
//check for node-edit
   
if (arg(0) == 'node' && is_numeric(arg(1))) {
       
$node = node_load(array('nid' => arg(1)));
        if (!
in_array($node->type,$blacklist)) {
           
$match = true;
        }
    }
 
   
//check for node-add
   
if(arg(0) == 'node' && arg(1) == 'add') {
        if(!
in_array(arg(2),$blacklist)) {
           
$match = true;
        }
    }

   
//check for comments
   
$url = request_uri();
    if (
strpos($url, "comment")) {
   
$match = true;
    }

return
$match;
?>

 
 

Drupal is a registered trademark of Dries Buytaert.