You are here

function wysiwyg_profile_form_submit in Wysiwyg 6

Same name and namespace in other branches
  1. 5.2 wysiwyg.admin.inc \wysiwyg_profile_form_submit()
  2. 5 wysiwyg.admin.inc \wysiwyg_profile_form_submit()
  3. 6.2 wysiwyg.admin.inc \wysiwyg_profile_form_submit()
  4. 7.2 wysiwyg.admin.inc \wysiwyg_profile_form_submit()

Submit callback for Wysiwyg profile form.

See also

wysiwyg_profile_form()

File

./wysiwyg.admin.inc, line 320
Integrate Wysiwyg editors into Drupal.

Code

function wysiwyg_profile_form_submit($form, &$form_state) {
  if (isset($form_state['values']['buttons'])) {

    // Store only enabled buttons for each plugin.
    foreach ($form_state['values']['buttons'] as $plugin => $buttons) {
      $form_state['values']['buttons'][$plugin] = array_filter($form_state['values']['buttons'][$plugin]);
    }

    // Store only enabled plugins.
    $form_state['values']['buttons'] = array_filter($form_state['values']['buttons']);
  }

  // Remove input format name.
  $format = $form_state['values']['format'];
  $input_format = $form_state['values']['input_format'];
  $editor = $form_state['values']['editor'];
  unset($form_state['values']['format'], $form_state['values']['input_format'], $form_state['values']['editor']);

  // Remove FAPI values.
  // @see system_settings_form_submit()
  unset($form_state['values']['submit'], $form_state['values']['form_id'], $form_state['values']['op'], $form_state['values']['form_token']);

  // Insert new profile data.
  db_query("UPDATE {wysiwyg} SET settings = '%s' WHERE format = %d", serialize($form_state['values']), $format);
  drupal_set_message(t('Wysiwyg profile for %format has been saved.', array(
    '%format' => $input_format,
  )));
  drupal_goto('admin/settings/wysiwyg/profile');
}