Community & Support

Override TinyMCE visibility for specific CCK type

I'm not sure if there is a way to do this but I would like to override or disable TinyMCE when a particular type of content is being edited and for the TinyMCE configuration screen too. Everything else can have TinyMCE present.

The type of content is called video_clip which contains JavaScript that tinyMCE will mess up. I have tried the following without success:
[code]

<?php
 
if ($node->type == 'video_clip')
    return
false;
  else
    return
true;
?>

[/code]

in page.tpl.php "if ($node->type == 'video_clip')" will return true for this particular node type however it does not seem to work within the TinyMCE configuration scope.

Any thoughts?

Thanks,
Andrew

Comments

Load node first

As far as I see, the same rules as for block-visibility apply. So I modified a code-snipped from http://drupal.org/node/64135 - to display TinyMCE also when adding new pages. Difference to awasson's solution: node has to be loaded first.

<?php
$match
= FALSE;
$types = array('story' => 1, 'page' => 1);
if (
arg(0) == 'node' && is_numeric(arg(1))) {
 
$nid = arg(1);
 
$node = node_load(array('nid' => $nid));
 
$type = $node->type;
  if (isset(
$types[$type])) {
   
$match = TRUE;
  }
}
else if (
arg(0) == 'node' &&
 
arg(1) == 'add' &&
  isset(
$types[arg(2)])) {
   
$match = TRUE;
}
return
$match;
?>

Thank you for this code. If

Thank you for this code.

If anyone else is using nodecomments, you'll need to add && arg(2) == 'edit' to line #4's if statement if you want to avoid TinyMCEing the included comments form.

Follow-up

After subsequent research, I discovered that this would go in

Administer > Site configuration > TinyMCE > Visibility

And the above code is required for adding new nodes, as was mentioned.

Thank you!!

More information?

This looks helpful, but more information is necessary to connect it to the original post.

Where does this code go? What gets changes to support "video_clip"?

Thanks, in advance, for assistance.

Great Idea

Nice invention. sure is helpful.

Charles