On this page
Disable TinyMCE for dynamically named textareas
You are browsing documentation for an older version of Drupal, which is not supported any longer, and the information may not be correct. See current documentation for Contributed modules
description
Here's a simple way to disable TinyMCE on textareas where the id is named dynamically. I needed this for use with the flashvideo_module. It creates a textarea that lists the uploaded video, and names it id = 'edit-files-XYZ-description', where XYZ is the file id (fid) and is unique to each node.
Step 1 of 1
Grab the theme_tinymce_theme function from tinymce.module, and copy it to your template.php file, renaming it to phptemplate_tinymce_theme, then modify it as follows:
function phptemplate_tinymce_theme($init, $textarea_name, $theme_name, $is_running) {
if ($textarea_name = 'files-'.$node->fid.'-description'){
$flashvid_exempt = $textarea_name;
}
switch ($textarea_name) {
// Disable tinymce for these textareas
case 'log': // book and page log
case 'img_assist_pages':
case 'caption': // signature
case 'pages':
case '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
case $flashvid_exempt:
unset($init);
break;
The rest of the code in this function is unchanged, so I didn't duplicate it here.
Hopefully this approach is useful to someone else.
Doug Gough
Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion