You are here

function bueditor_form_editor_submit in BUEditor 5

Editor form submitted.

File

./bueditor.module, line 239

Code

function bueditor_form_editor_submit($form_id, $edit) {
  $eid = $edit['editor']['eid'];
  switch ($edit['op']) {
    case t('Save'):
      $eid = bueditor_editor_add($edit['editor']);
      foreach ($_POST['button'] as $bid => $button) {
        $button['bid'] = $bid;
        $button['eid'] = $eid;
        bueditor_button_add($button);
      }
      drupal_set_message(t('Changes have been saved.'));
      break;
    case t('Go'):
      if (is_array($edit['checks'])) {
        $bids = array();
        foreach ($edit['checks'] as $bid => $val) {
          if ($val) {
            $bids[] = $bid;
          }
        }
        if (count($bids)) {
          if ($edit['selaction'] == 'delete') {
            foreach ($bids as $bid) {
              bueditor_button_delete($bid);
            }
            drupal_set_message(t('Selected buttons have been deleted.'));
          }
          else {
            if ($edit['selaction'] == 'export') {
              bueditor_export_buttons($bids);
            }
          }
        }
      }
      break;
    case t('Import'):
      if ($file = file_check_upload('buecsv')) {
        $_SESSION['buecsv'] = $file->filepath;
      }
      break;
  }
  return 'admin/settings/bueditor/' . $eid;
}