You are here

function simplenews_admin_issues_submit in Simplenews 7

Same name and namespace in other branches
  1. 7.2 includes/simplenews.admin.inc \simplenews_admin_issues_submit()

Form submit callback for the issue operations.

1 string reference to 'simplenews_admin_issues_submit'
simplenews_admin_issues in includes/simplenews.admin.inc
Form builder: Builds a list of newsletters with operations.

File

includes/simplenews.admin.inc, line 230
Newsletter admin, subscription admin, simplenews settings

Code

function simplenews_admin_issues_submit($form, &$form_state) {

  // Call operation functions as defined in hook_simplenews_issue_operations().
  $operations = module_invoke_all('simplenews_issue_operations');
  $operation = $operations[$form_state['values']['operation']];

  // Filter out unchecked list issues
  $nids = array_filter($form_state['values']['issues']);
  if ($function = $operation['callback']) {

    // Add in callback arguments if present.
    if (isset($operation['callback arguments'])) {
      $args = array_merge(array(
        $nids,
      ), $operation['callback arguments']);
    }
    else {
      $args = array(
        $nids,
      );
    }
    call_user_func_array($function, $args);
  }
  else {

    // We need to rebuild the form to go to a second step. For example, to
    // show the confirmation form for the deletion of nodes.
    $form_state['rebuild'] = TRUE;
  }
}