You are here

function notifications_manage_subscriptions_form_submit in Notifications 7

Same name and namespace in other branches
  1. 6.4 notifications.manage.inc \notifications_manage_subscriptions_form_submit()
  2. 6 notifications.manage.inc \notifications_manage_subscriptions_form_submit()
  3. 6.2 notifications.manage.inc \notifications_manage_subscriptions_form_submit()
  4. 6.3 notifications.manage.inc \notifications_manage_subscriptions_form_submit()

Handle manage form submissions, run batch operations

1 string reference to 'notifications_manage_subscriptions_form_submit'
notifications_manage_subscriptions_form_options in ./notifications.manage.inc
Form options

File

./notifications.manage.inc, line 149
Common functions for bulk management of subscriptions

Code

function notifications_manage_subscriptions_form_submit($form, &$form_state) {
  $operations = notifications_manage_subscriptions_operations();
  $operation = $operations[$form_state['values']['operation']];

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

    // Add in callback arguments if present.
    if (isset($operation['callback arguments'])) {
      $args = array_merge(array(
        $items,
      ), $operation['callback arguments']);
    }
    else {
      $args = array(
        $items,
      );
    }
    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 subscriptions.
    $form_state['rebuild'] = TRUE;
  }
}