You are here

function bueditor_editor_submit in BUEditor 6.2

Same name and namespace in other branches
  1. 6 bueditor.admin.inc \bueditor_editor_submit()
  2. 7 admin/bueditor.admin.inc \bueditor_editor_submit()

Editor form submission.

1 string reference to 'bueditor_editor_submit'
bueditor_editor_form in admin/bueditor.admin.inc
Editor form.

File

admin/bueditor.admin.inc, line 366

Code

function bueditor_editor_submit($form, &$form_state) {
  $editor = (object) $form_state['values']['editor'];
  $buttons = array();
  foreach ($form_state['values']['buttons'] as $bid => $button) {
    if ($button['title']) {
      $button['bid'] = $bid;
      $button['content'] = str_replace("\r\n", "\n", $button['content']);
      $buttons[] = (object) $button;
    }
  }
  $old = $editor->eid;
  if ($editor = bueditor_write_editor($editor, $buttons)) {
    $form_state['redirect'] = 'admin/settings/bueditor/' . $editor->eid;
    $old ? drupal_set_message(t('The changes have been saved.')) : bueditor_message_added($editor->name);
  }
}