You are here

function wysiwyg_whizzywig_settings in Wysiwyg 5

Same name and namespace in other branches
  1. 5.2 editors/whizzywig.inc \wysiwyg_whizzywig_settings()
  2. 6.2 editors/whizzywig.inc \wysiwyg_whizzywig_settings()
  3. 6 editors/whizzywig.inc \wysiwyg_whizzywig_settings()
  4. 7.2 editors/whizzywig.inc \wysiwyg_whizzywig_settings()

Return runtime editor settings for a given wysiwyg profile.

Parameters

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

$config: An array containing wysiwyg editor profile settings.

$theme: The name of a theme/GUI/skin to use.

Return value

A settings array to be populated in Drupal.settings.wysiwyg.configs.{editor}

1 string reference to 'wysiwyg_whizzywig_settings'
wysiwyg_whizzywig_editor in editors/whizzywig.inc
Plugin implementation of hook_editor().

File

editors/whizzywig.inc, line 65

Code

function wysiwyg_whizzywig_settings($editor, $config, $theme) {
  $settings = array();

  // Add path to button images, if available.
  if (is_dir(wysiwyg_get_path('whizzywig') . '/btn')) {
    $settings['buttonPath'] = wysiwyg_get_path('whizzywig', TRUE) . '/btn/';
  }

  // Add configured buttons or all available.
  if (!empty($config['buttons'])) {
    $buttons = array();
    foreach ($config['buttons'] as $plugin) {
      $buttons = array_merge($buttons, $plugin);
    }
    $settings['buttons'] = implode(' ', array_keys($buttons));
  }
  else {
    $settings['buttons'] = 'all';
  }

  // Add editor content stylesheet.
  if (isset($config['css_setting'])) {
    if ($config['css_setting'] == 'theme') {
      $css = path_to_theme() . '/style.css';
      if (file_exists($css)) {
        $settings['externalCSS'] = base_path() . $css;
      }
    }
    else {
      if ($config['css_setting'] == 'self' && isset($config['css_path'])) {
        $settings['externalCSS'] = strtr($config['css_path'], array(
          '%b' => base_path(),
          '%t' => path_to_theme(),
        ));
      }
    }
  }
  return $settings;
}