You are here

function ckeditor_wysiwyg_plugin_settings in CKEditor for WYSIWYG Module 7

Build a JS settings array of native external plugins that need to be loaded separately.

1 string reference to 'ckeditor_wysiwyg_plugin_settings'
ckeditor_ckeditor_extended_editor in includes/ckeditor_extended.inc
Plugin implementation of hook_editor().

File

includes/ckeditor_extended.inc, line 81
Editor integration functions for CKEditor.

Code

function ckeditor_wysiwyg_plugin_settings($editor, $profile, $plugins) {
  $settings = array();

  // Pull the list of required plugins from the CKEditor JS settings.
  // TODO: Abstract the list of enabled plugins so we can get at this
  // information more easily?
  $editor_js_settings = ckeditor_wysiwyg_settings($editor, $profile->settings, NULL);
  $plugins = explode(',', $editor_js_settings['extraPlugins']);
  $plugin_info = ckeditor_plugins();
  foreach ($plugins as $name) {

    // Skip plugins that are no longer available.
    if (!isset($plugin_info[$name])) {
      continue;
    }
    $plugin = $plugin_info[$name];

    // Register all plugins that need to be loaded.
    $settings[$name] = array();

    // Add path for native external plugins.
    if (empty($plugin['internal']) && isset($plugin['path'])) {
      $settings[$name]['path'] = base_path() . $plugin['path'] . '/';
    }

    // CKEditor defaults to 'plugin.js' on its own when filename is not set.
    if (!empty($plugin['file'])) {
      $settings[$name]['fileName'] = $plugin['file'];
    }
  }
  return $settings;
}