Community Documentation

Disable TinyMCE for webforms

Last updated April 9, 2008. Created by two2the8 on April 9, 2008.
Log in to edit this page.

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;
?>

Comments

Awesome, works perfectly.

Awesome, works perfectly. Thanks for this!

Works with Drupal 6

Thank you for the code. Perfect.

My apologies if this is

My apologies if this is *really* stupid, but I cant find

' "Show if the following PHP code returns TRUE (PHP-mode, experts only)" area of the tinymce settings for a given profile '

Where exactly is this? (using Drupal 6.16)

About this page

Drupal version
Drupal 5.x

Reference

Drupal’s online documentation is © 2000-2012 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License.