TinyMCE - Excluding textboxes
Posted August 19th, 2008 by DrupalThese are the text boxes that I have excluded by default so far. It would be easier to just include the ones that you want - but that's not the way it's setup.
As I find more module specific text boxes that I want excluded, I will update the script here.
<?php
/**
* 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:
*
* http://tinymce.moxiecode.com/wrapper.php?url=tinymce/docs/using.htm
*
* @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 phptemplate_tinymce_theme($init, $textarea_name, $theme_name, $is_running) {
// print " TEXTAREA NAME: $textarea_name"; // WILL HELP IDENTIFY FIELD NAMES
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':
case 'message': // taxonomy terms
case 'field-location-description-0-value':
case 'field-short-description-0-value':
case 'recipients':
case 'teaserfield':
case 'rss':
case 'bodyfield':
case 'nodewords-description': // Meta-tags
unset($init);
break;
// Force the 'simple' theme for some of the smaller textareas.
case 'signature':
case 'site_mission':
case 'site_footer':
case 'site_offline_message':
case 'page_help':
case 'user_registration_help':
case 'user_picture_guidelines':
$init['theme'] = 'simple';
foreach ($init as $k => $v) {
if (strstr($k, 'theme_advanced_')) unset($init[$k]);
}
break;
}
/* 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]');
break;
}
}
*/
// Always return $init
return $init;
}
?>
Post new comment