You are here

function ad_admin_ads_submit in Advertisement 5.2

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

Submit the ad administration update form.

File

./ad.module, line 1566
An advertising system for Drupal powered websites.

Code

function ad_admin_ads_submit($form_id, $form_values) {
  $operations = module_invoke_all('ad_operations');
  $operation = $operations[$form_values['operation']];

  // Filter out unchecked nodes
  $ads = array_filter($form_values['ads']);
  if ($function = $operation['callback']) {

    // Add in callback arguments if present.
    if (isset($operation['callback arguments'])) {
      $args = array_merge(array(
        $ads,
      ), $operation['callback arguments']);
    }
    else {
      $args = array(
        $ads,
      );
    }
    call_user_func_array($function, $args);
    drupal_set_message(t('The update has been performed.'));
    cache_clear_all();
    ad_rebuild_cache(TRUE);
  }
}