You are here

function ckeditor_admin_profile_form_submit in CKEditor - WYSIWYG HTML editor 7

Same name and namespace in other branches
  1. 6 includes/ckeditor.admin.inc \ckeditor_admin_profile_form_submit()

Form submit for a profile

File

includes/ckeditor.admin.inc, line 1674
CKEditor - The text editor for the Internet - http://ckeditor.com Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.

Code

function ckeditor_admin_profile_form_submit($form, &$form_state) {
  $edit =& $form_state['values'];
  if (isset($edit['_profile'])) {
    ckeditor_profile_delete($edit['_profile']->name);
    drupal_set_message(t('Your CKEditor profile was updated.'));
  }
  else {
    drupal_set_message(t('Your CKEditor profile was created.'));
  }
  $settings = ckeditor_admin_values_to_settings($edit);
  db_insert('ckeditor_settings')
    ->fields(array(
    "name" => $edit['name'],
    "settings" => $settings,
  ))
    ->execute();
  if (!empty($edit['input_formats'])) {
    foreach (array_keys($edit['input_formats']) as $format) {
      if ($edit['input_formats'][$format] != '0') {
        db_insert('ckeditor_input_format')
          ->fields(array(
          "name" => $edit['name'],
          "format" => $format,
        ))
          ->execute();
      }
    }
  }
  $form_state['redirect'] = 'admin/config/content/ckeditor';
}