You are here

function contact_category_edit_form_submit in Contact 6.2

Same name and namespace in other branches
  1. 7.2 contact.admin.inc \contact_category_edit_form_submit()

Process the contact category edit page form submission.

File

./contact.admin.inc, line 129
Admin page callbacks for the contact module.

Code

function contact_category_edit_form_submit($form, &$form_state) {
  if ($form_state['values']['selected']) {

    // Unselect all other contact categories.
    db_query('UPDATE {contact} SET selected = 0');
  }
  if (empty($form_state['values']['cid'])) {
    drupal_write_record('contact', $form_state['values']);
  }
  else {
    drupal_write_record('contact', $form_state['values'], array(
      'cid',
    ));
  }
  drupal_set_message(t('Category %category has been saved.', array(
    '%category' => $form_state['values']['category'],
  )));
  watchdog('contact', 'Category %category has been saved.', array(
    '%category' => $form_state['values']['category'],
  ), WATCHDOG_NOTICE, l(t('Edit'), 'admin/build/contact/edit/' . $form_state['values']['cid']));
  $form_state['redirect'] = 'admin/build/contact';
}