You are here

function biblio_admin_keyword_edit_form_submit in Bibliography Module 7

Same name and namespace in other branches
  1. 6.2 includes/biblio.admin.inc \biblio_admin_keyword_edit_form_submit()
  2. 6 biblio.admin.inc \biblio_admin_keyword_edit_form_submit()
  3. 7.2 includes/biblio.admin.inc \biblio_admin_keyword_edit_form_submit()

_state

Parameters

$form:

File

includes/biblio.admin.inc, line 3006
biblio.admin.inc

Code

function biblio_admin_keyword_edit_form_submit($form, &$form_state) {
  switch ($form_state['values']['op']) {
    case t('Save'):
      drupal_write_record('biblio_keyword_data', $form_state['values'], 'kid');
      if (isset($form_state['values']['merge_words'])) {
        $kids = array_filter($form_state['values']['merge_words']);
        if (count($kids)) {
          db_update('biblio_keyword')
            ->fields(array(
            'kid' => $form_state['values']['kid'],
          ))
            ->condition('kid', $kids, 'IN')
            ->execute();
          db_delete('biblio_keyword_data')
            ->condition('kid', $kids, 'IN')
            ->execute();
        }
      }
      break;
    case t('Delete'):
      $base = variable_get('biblio_base', 'biblio');
      unset($_GET['destination']);
      $form_state['redirect'] = "{$base}/keyword/" . $form_state['values']['kid'] . '/delete';
      break;
    case t('Cancel'):
      $base = variable_get('biblio_base', 'biblio');
      $form_state['redirect'] = $base . '/keywords';
      break;
  }
}