You are here

function wysiwyg_get_editor_config in Wysiwyg 7.2

Same name and namespace in other branches
  1. 5.2 wysiwyg.module \wysiwyg_get_editor_config()
  2. 5 wysiwyg.module \wysiwyg_get_editor_config()
  3. 6.2 wysiwyg.module \wysiwyg_get_editor_config()
  4. 6 wysiwyg.module \wysiwyg_get_editor_config()

Return an array of initial editor settings for a Wysiwyg profile.

1 call to wysiwyg_get_editor_config()
wysiwyg_add_editor_settings in ./wysiwyg.module
Add editor settings for a given input format.

File

./wysiwyg.module, line 695

Code

function wysiwyg_get_editor_config($profile, $theme) {
  $editor = wysiwyg_get_editor($profile->editor);
  $settings = array();
  $installed_version = $editor['installed version'];
  $settings = $profile->settings;
  if (!empty($editor['settings callback']) && function_exists($editor['settings callback'])) {
    if (!empty($profile->preferences['version']) && !empty($installed_version)) {
      $profile_version = $profile->preferences['version'];
      $version_status = version_compare($profile_version, $installed_version);
      if ($version_status !== 0) {

        // Installed version is different from profile version. Silently migrate
        // the stored editor settings to the installed version if possible.
        $migrated = FALSE;
        if (!empty($editor['migrate settings callback']) && function_exists($editor['migrate settings callback'])) {
          $migrated = $editor['migrate settings callback']($settings, $editor, $profile_version, $installed_version);
        }
      }
    }
    $settings = $editor['settings callback']($editor, $settings, $theme);

    // Allow other modules to alter the editor settings for this format.
    $context = array(
      'editor' => $editor,
      'profile' => $profile,
      'theme' => $theme,
    );
    drupal_alter('wysiwyg_editor_settings', $settings, $context);
  }
  return $settings;
}