You are here

function ckeditor_config_editor_js_settings_alter in CKEditor custom config 8.2

Same name and namespace in other branches
  1. 8.3 ckeditor_config.module \ckeditor_config_editor_js_settings_alter()

Implements hook_editor_js_settings_alter().

File

./ckeditor_config.module, line 42
Provides UI to manage CKEditor configuration.

Code

function ckeditor_config_editor_js_settings_alter(array &$settings) {
  foreach ($settings['editor']['formats'] as &$editor) {
    if (isset($editor['editorSettings']['ckeditor_custom_config'])) {

      // Loop through custom config values and set/override settings.
      foreach ($editor['editorSettings']['ckeditor_custom_config'] as $name => $value) {
        $editor['editorSettings'][$name] = $value;
      }
    }

    // Settings have been copied to 'editorSettings' and can now be removed.
    unset($editor['editorSettings']['ckeditor_custom_config']);
  }
}