You are here

function newsletter_list_submit in Newsletter 7

Same name and namespace in other branches
  1. 7.2 modules/list/includes/newsletter_list.admin.inc \newsletter_list_submit()

File

includes/newsletter.admin.inc, line 660
Admin page callbacks for the newsletter module.

Code

function newsletter_list_submit($form, &$form_state) {
  $operation = $form_state['values']['operation'];
  $ids = array_filter($form_state['values']['list']);
  if ($ids) {
    switch ($operation) {
      case 'delete':
        if (!isset($form_state['storage']['confirm'])) {
          $form_state['storage']['confirm'] = TRUE;
          $form_state['rebuild'] = TRUE;
          return;
        }
        foreach ($ids as $id) {
          entity_get_controller('newsletter_list')
            ->delete($id);
        }
        drupal_set_message(t('Lists deleted successfully'), 'status');
        break;
    }
  }
  else {
    drupal_set_message(t('Please Select an action to perform.'), 'warning');
  }
}