You are here

function wysiwyg_nicedit_settings in Wysiwyg 7.2

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. 6 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 76
Editor integration functions for NicEdit.

Code

function wysiwyg_nicedit_settings($editor, $config, $theme) {
  $settings = array(
    'iconsPath' => base_path() . $editor['library path'] . '/nicEditorIcons.gif',
  );

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

  // Add editor content stylesheet.
  // @todo Drop stylsheet support since it's only used in FF2.
  if (isset($config['css_setting'])) {
    if ($config['css_setting'] == 'theme') {
      $css = drupal_get_path('theme', variable_get('theme_default', NULL)) . '/style.css';
      if (file_exists($css)) {
        $settings['externalCSS'] = base_path() . $css;
      }
    }
    elseif ($config['css_setting'] == 'self' && isset($config['css_path'])) {
      $settings['externalCSS'] = strtr($config['css_path'], array(
        '%b' => base_path(),
        '%t' => drupal_get_path('theme', variable_get('theme_default', NULL)),
        '%q' => variable_get('css_js_query_string', ''),
      ));
    }
  }
  return $settings;
}