You are here

function wysiwyg_ckeditor_themes in Wysiwyg 6.2

Same name and namespace in other branches
  1. 5.2 editors/ckeditor.inc \wysiwyg_ckeditor_themes()
  2. 7.2 editors/ckeditor.inc \wysiwyg_ckeditor_themes()

Determine available editor themes or check/reset a given one.

Parameters

$editor: A processed hook_editor() array of editor properties.

$profile: A wysiwyg editor profile.

Return value

An array of theme names. The first returned name should be the default theme name.

2 string references to 'wysiwyg_ckeditor_themes'
hook_INCLUDE_editor in ./wysiwyg.api.php
Define a Wysiwyg editor library.
wysiwyg_ckeditor_editor in editors/ckeditor.inc
Plugin implementation of hook_editor().

File

editors/ckeditor.inc, line 197
Editor integration functions for CKEditor.

Code

function wysiwyg_ckeditor_themes($editor, $profile) {

  // @todo Skins are not themes but this will do for now.
  $path = $editor['library path'] . '/skins/';
  if (file_exists($path) && ($dir_handle = opendir($path))) {
    $themes = array();
    while ($file = readdir($dir_handle)) {
      if (is_dir($path . $file) && substr($file, 0, 1) != '.' && $file != 'CVS') {
        $themes[] = $file;
      }
    }
    closedir($dir_handle);
    natcasesort($themes);
    $themes = array_values($themes);
    return !empty($themes) ? $themes : array(
      'default',
    );
  }
  else {
    return array(
      'default',
    );
  }
}