You are here

function editor_ckeditor_link_dialog_save in Editor 7

Form AJAX callback. Sends the save editor AJAX command and closes the dialog.

See also

filter_format_editor_link_form()

filter_format_editor_image_form()

1 string reference to 'editor_ckeditor_link_dialog_save'
editor_ckeditor_link_dialog_form in modules/editor_ckeditor/includes/editor_ckeditor.pages.inc
Form callback: Display a form for inserting/editing a link.

File

modules/editor_ckeditor/includes/editor_ckeditor.pages.inc, line 64
Page callbacks for the Editor CKEditor module.

Code

function editor_ckeditor_link_dialog_save($form, &$form_state) {
  $commands = array();
  if (form_get_errors()) {
    unset($form['#prefix'], $form['#suffix']);
    $status_messages = array(
      '#theme' => 'status_messages',
    );
    $output = drupal_render($form);
    $output = '<div>' . drupal_render($status_messages) . $output . '</div>';
    $commands[] = ajax_command_html('#editor-ckeditor-link-dialog-form', $output);
  }
  else {
    $commands[] = editor_command_editor_dialog_save($form_state['values']);
    $commands[] = dialog_command_close_modal_dialog();
  }
  return array(
    '#type' => 'ajax',
    '#commands' => $commands,
  );
}