You are here

function mee_update_7003 in Scald: Media Management made easy 7

Update plugins paths in CKEditor profiles.

File

modules/fields/mee/mee.install, line 182
MEE installer.

Code

function mee_update_7003() {
  if (module_exists('ckeditor')) {
    module_load_include('inc', 'ckeditor', 'includes/ckeditor.lib');
    $profiles_list = ckeditor_profile_input_formats();
    $plugins_list = ckeditor_load_plugins();
    foreach ($profiles_list as $_profile => $_inputs) {
      $changed = FALSE;
      $profile = ckeditor_profile_load($_profile);
      if (!isset($profile->settings['loadPlugins'])) {
        continue;
      }
      foreach (array_keys((array) $profile->settings['loadPlugins']) as $plugin_name) {
        if (in_array($plugin_name, array(
          'dnd',
          'dndck4',
        ))) {
          $profile->settings['loadPlugins'][$plugin_name] = $plugins_list[$plugin_name];
          $changed = TRUE;
        }
      }
      if ($changed === TRUE) {
        db_update('ckeditor_settings')
          ->fields(array(
          'settings' => serialize($profile->settings),
        ))
          ->condition('name', $profile->name, '=')
          ->execute();
      }
    }
  }
}