function editor_form_filter_admin_format_submit

Additional submit handler for filter_admin_format_form().

1 string reference to 'editor_form_filter_admin_format_submit'

File

drupal/core/modules/editor/editor.module, line 267
Adds bindings for client-side "text editors" to text formats.

Code

function editor_form_filter_admin_format_submit($form, &$form_state) {

  // Delete the existing editor if disabling or switching between editors.
  $format_id = $form['#format']->format;
  $original_editor = editor_load($format_id);
  if ($original_editor && $original_editor->editor != $form_state['values']['editor']) {
    $original_editor
      ->delete();
  }

  // Create a new editor or update the existing editor.
  if ($form_state['editor'] !== FALSE) {

    // Ensure the text format is set: when creating a new text format, this
    // would equal the empty string.
    $form_state['editor']->format = $form['#format']->format;
    $form_state['editor']->settings = $form_state['values']['editor']['settings'];
    $form_state['editor']
      ->save();
  }
}