function contact_category_edit_form_submit

Form submission handler for contact_category_edit_form().

See also

contact_category_edit_form_validate()

File

modules/contact/contact.admin.inc, line 168

Code

function contact_category_edit_form_submit($form, &$form_state) {
    if ($form_state['values']['selected']) {
        // Unselect all other contact categories.
        db_update('contact')->fields(array(
            'selected' => '0',
        ))
            ->execute();
    }
    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/structure/contact/edit/' . $form_state['values']['cid']));
    $form_state['redirect'] = 'admin/structure/contact';
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.