You are here

function ad_admin_group_form_submit in Advertisement 6

Same name and namespace in other branches
  1. 5.2 ad.module \ad_admin_group_form_submit()
  2. 5 ad.module \ad_admin_group_form_submit()
  3. 6.3 ad.admin.inc \ad_admin_group_form_submit()
  4. 6.2 ad.admin.inc \ad_admin_group_form_submit()
  5. 7 ad.admin.inc \ad_admin_group_form_submit()

Save a newly created ad group.

File

./ad.admin.inc, line 870
Advertisement admin pages and functions.

Code

function ad_admin_group_form_submit($form, &$form_state) {
  $status = taxonomy_save_term($form_state['values']);
  switch ($status) {
    case SAVED_NEW:
      $groups = variable_get('ad_groups', array());
      $groups[] = $form_state['values']['tid'];
      variable_set('ad_groups', $groups);
      drupal_set_message(t('Created new ad group %term.', array(
        '%term' => $form_state['values']['name'],
      )));
      break;
    case SAVED_UPDATED:
      drupal_set_message(t('The ad group %term has been updated.', array(
        '%term' => $form_state['values']['name'],
      )));
  }
  $form_state['redirect'] = 'admin/content/ad/groups';
}