You are here

function wysiwyg_nicedit_settings in Wysiwyg 6

Same name and namespace in other branches
  1. 5.2 editors/nicedit.inc \wysiwyg_nicedit_settings()
  2. 5 editors/nicedit.inc \wysiwyg_nicedit_settings()
  3. 6.2 editors/nicedit.inc \wysiwyg_nicedit_settings()
  4. 7.2 editors/nicedit.inc \wysiwyg_nicedit_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_nicedit_settings'
wysiwyg_nicedit_editor in editors/nicedit.inc
Plugin implementation of hook_editor().

File

editors/nicedit.inc, line 60

Code

function wysiwyg_nicedit_settings($editor, $config, $theme) {
  $settings = array(
    'iconsPath' => wysiwyg_get_path('nicedit', TRUE) . '/nicEditorIcons.gif',
  );

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

  // 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;
}