You are here

function notifications_custom_form_submit in Notifications 6

Same name and namespace in other branches
  1. 6.4 notifications_custom/notifications_custom.admin.inc \notifications_custom_form_submit()

Form submission for custom subscriptions form

File

notifications_custom/notifications_custom.admin.inc, line 142

Code

function notifications_custom_form_submit($form, &$form_state) {
  $op = isset($form_state['values']['op']) ? $form_state['values']['op'] : '';
  $subs = $form_state['values']['subscription'];
  if ($op == t('Reset to defaults')) {
    notifications_custom_delete($subs['type']);
    notifications_custom_rebuild();
  }
  elseif ($op == t('Delete')) {
    $form_state['redirect'] = 'admin/messaging/customsubs/csid/' . $subs['csid'] . '/delete';
  }
  elseif (empty($subs['csid'])) {
    drupal_write_record('notifications_custom', $subs);
    drupal_set_message(t('The subscription type has been created. Now you must add one or more fields to it.'));
    $form_state['redirect'] = 'admin/messaging/customsubs/csid/' . $subs['csid'] . '/fields';
  }
  else {
    drupal_write_record('notifications_custom', $subs, 'csid');
    drupal_set_message(t('The subscription type has been updated.'));
  }
}