enable / disable TinyMCE via template.php (Login/Logout Fix)

  1. <?php
  2. /**
  3. * Customize a TinyMCE theme.
  4. *
  5. * @param init
  6. *   An array of settings TinyMCE should invoke a theme. You may override any
  7. *   of the TinyMCE settings. Details here:
  8. *
  9. *    http://tinymce.moxiecode.com/wrapper.php?url=tinymce/docs/using.htm
  10. *
  11. * @param textarea_name
  12. *   The name of the textarea TinyMCE wants to enable.
  13. *
  14. * @param theme_name
  15. *   The default tinymce theme name to be enabled for this textarea. The
  16. *   sitewide default is 'simple', but the user may also override this.
  17. *
  18. * @param is_running
  19. *   A boolean flag that identifies id TinyMCE is currently running for this
  20. *   request life cycle. It can be ignored.
  21. */
  22. function phptemplate_tinymce_theme($init, $textarea_name, $theme_name, $is_running) {
  23.  
  24.   switch ($textarea_name) {
  25.     // Disable tinymce for these textareas
  26.     case 'log': // book and page log
  27.     case 'img_assist_pages':
  28.     case 'caption': // signature
  29.     case 'pages':
  30.     case 'access_pages': //TinyMCE profile settings.
  31.     case 'user_mail_welcome_body': // user config settings
  32.     case 'user_mail_approval_body': // user config settings
  33.     case 'user_mail_pass_body': // user config settings
  34.     case 'synonyms': // taxonomy terms
  35.     case 'description': // taxonomy terms    
  36.     case 'hours': //dealer page opening hours
  37.     case 'message': //contact form message
  38.     case 'nodewords-description': // meta tags description
  39.       unset($init);
  40.       break;
  41.  
  42.   }
  43.  
  44.   // Add some extra features when using the advanced theme.
  45.   // If $init is available, we can extend it
  46.   if (isset($init)) {
  47. /* This was quoted out as it caused a white screen login in and out
  48.     switch ($theme_name) {
  49.      case 'advanced':
  50.    $init['width'] = '100%'; //force editor content cell to full width!
  51.        break;
  52.  
  53.     }
  54. */
  55. if($theme_name=='advanced'){
  56.    $init['width'] = '100%'; //force editor content cell to full width!
  57. }
  58.  
  59.   }
  60.  
  61.  
  62.   // Always return $init
  63.   return $init;
  64. }
  65. ?>