You are here

function ad_admin_ads_submit in Advertisement 6.3

Same name and namespace in other branches
  1. 5.2 ad.module \ad_admin_ads_submit()
  2. 5 ad.module \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.admin.inc, line 215
Advertisement admin pages and functions.

Code

function ad_admin_ads_submit($form, &$form_state) {
  $operations = module_invoke_all('ad_operations');
  $operation = $operations[$form_state['values']['operation']];

  // Filter out unchecked nodes
  $ads = array_filter($form_state['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);
    cache_clear_all();
    ad_rebuild_cache(TRUE);
    drupal_set_message(t('The update has been performed.'));
  }
}