You are here

function _tinymce_get_themes in TinyMCE 5

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

Grab the themes available to TinyMCE.

TinyMCE themes control the functionality and buttons that are available to a user. Themes are only looked for within the default TinyMCE theme directory.

NOTE: This function is not used in this release. We are only using advanced theme.

Return value

An array of theme names.

File

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

Code

function _tinymce_get_themes() {
  static $themes = array();
  if (!$themes) {
    $theme_loc = drupal_get_path('module', 'tinymce') . '/tinymce/jscripts/tiny_mce/themes/';
    if (is_dir($theme_loc) && ($dh = opendir($theme_loc))) {
      while (($file = readdir($dh)) !== false) {
        if (!in_array($file, array(
          '.',
          '..',
          'CVS',
        )) && is_dir($theme_loc . $file)) {
          $themes[$file] = $file;
        }
      }
      closedir($dh);
      asort($themes);
    }
  }
  return $themes;
}