You are here

function theme_tinymce_theme in TinyMCE 6.2

Same name and namespace in other branches
  1. 5.2 tinymce.module \theme_tinymce_theme()
  2. 5 tinymce.module \theme_tinymce_theme()
  3. 6 tinymce.module \theme_tinymce_theme()

Customize a TinyMCE theme.

Parameters

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

textarea_name: The name of the textarea TinyMCE wants to enable.

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.

is_running: A boolean flag that identifies id TinyMCE is currently running for this request life cycle. It can be ignored.

1 theme call to theme_tinymce_theme()
tinymce_process_textarea in ./tinymce.module
Attach tinymce to a textarea

File

./tinymce.module, line 321
Integrate the TinyMCE editor (http://tinymce.moxiecode.com/) into Drupal.

Code

function theme_tinymce_theme($init, $textarea_name, $theme_name, $is_running) {

  // uncomment to debug this

  /*   print_r($init);
      print_r($textarea_name);
      print_r($theme_name);
      print_r($is_running);
  */
  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
      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;
}