You are here

function media_wysiwyg_wysiwyg_editor_settings_alter in D7 Media 7.3

Same name and namespace in other branches
  1. 7.4 modules/media_wysiwyg/media_wysiwyg.module \media_wysiwyg_wysiwyg_editor_settings_alter()

Implements hook_wysiwyg_editor_settings_alter().

File

modules/media_wysiwyg/media_wysiwyg.module, line 396
Primarily Drupal hooks.

Code

function media_wysiwyg_wysiwyg_editor_settings_alter(&$settings, $context) {

  // Always load the 'mediaJustify' plugin for ckeditor whenever the cross
  // editor 'media' plugin is loaded in wysiwyg configurations. In order to
  // achieve consistent media alignment this should always be loaded whenever
  // the media module is.
  if ($context['editor']['name'] == 'ckeditor' && isset($context['profile']->settings['buttons']['drupal']['media']) && $context['profile']->settings['buttons']['drupal']['media']) {
    drupal_add_js(drupal_get_path('module', 'media_wysiwyg') . '/js/ckeditor/mediaJustify/plugin.js');
    $extra_plugins = explode(',', $settings['extraPlugins']);
    if (in_array('media', $extra_plugins) && !in_array('mediaJustify', $extra_plugins)) {
      $settings['extraPlugins'] .= ',mediaJustify';
    }
  }
}