You are here

function custom_admin_settings_submit in Spam 5.3

Perform bulk operations on the filters.

File

filters/custom/custom.module, line 413

Code

function custom_admin_settings_submit($form_id, $form_values) {
  if (is_array($form_values['custom'])) {
    foreach ($form_values['custom'] as $cid => $selected) {
      if ($selected) {
        $process[] = $cid;
      }
    }
  }
  if (!empty($process)) {
    foreach (module_invoke_all('spam_custom_operations') as $operation => $op) {
      $options[$operation] = $op;
    }
    $operation = $form_values['operation'];
    if (isset($options[$operation])) {
      $function = $options[$operation]['callback'];
      $arguments = $options[$operation]['callback arguments'];
      foreach ($process as $cid) {
        call_user_func_array($function, array_merge($arguments, array(
          $cid,
        )));
      }
    }
  }
}