You are here

function n1ed_editor_js_settings_alter in N1ED - Visual editor as CKEditor plugin with Bootstrap support 8.2

Same name and namespace in other branches
  1. 8 n1ed.module \n1ed_editor_js_settings_alter()

Changing CKEditor configuration - adding CKEditor skin "n1theme".

File

./n1ed.module, line 35
Main code for N1ED module.

Code

function n1ed_editor_js_settings_alter(array &$settings) {
  foreach (array_keys($settings['editor']['formats']) as $text_format_id) {
    if ($settings['editor']['formats'][$text_format_id]['editor'] === 'ckeditor') {
      $settings['editor']['formats'][$text_format_id]['editorSettings']['skin'] = 'n1theme,' . \Drupal::request()
        ->getBaseUrl() . '/' . drupal_get_path('module', 'n1ed') . "/js/skin/n1theme/";
      if ($settings['editor']['formats'][$text_format_id]['editorSettings']['enableN1EDEcoSystem'] == 'false') {
        if (!$settings['N1EDFreeFormat']) {
          $settings['N1EDFreeFormat'] = $text_format_id;
        }
      }
    }
  }

  // drupal_add_js(['N1EDFreeFormat' => 'basic_html'],'settings')
  // dump(user_func_exist());
}