You are here

function wysiwyg_profile_overview_submit in Wysiwyg 6.2

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

Submit callback for Wysiwyg profile overview form.

See also

wysiwyg_profile_overview()

File

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

Code

function wysiwyg_profile_overview_submit($form, &$form_state) {
  $editor = wysiwyg_get_editor($form_state['values']['formats']['_new_profile']['editor']);
  $format = $form_state['values']['formats']['_new_profile']['name'];
  $profile = array(
    'name' => 'format' . $format,
    'new' => TRUE,
    'editing' => TRUE,
    'format' => $format,
    'editor' => $editor['name'],
    'settings' => array(),
    'preferences' => array(
      'default' => TRUE,
      'show_toggle' => TRUE,
      'user_choose' => FALSE,
      'version' => $editor['installed version'],
    ),
  );
  $profile = (object) $profile;

  // Cache the profile for editing.
  wysiwyg_ui_profile_cache_set($profile);

  // If there is a destination query, ensure we still redirect the user to the
  // edit view page, and then redirect the user to the destination.
  $destination = array();
  if (isset($_GET['destination'])) {
    $destination = drupal_get_destination();
    unset($_GET['destination']);
  }
  $form_state['redirect'] = array(
    'admin/settings/wysiwyg/profile/' . $format . '/edit',
    array(
      'query' => $destination,
    ),
  );
}