You are here

function ad_embed_admin_configure_settings_submit in Advertisement 6.2

Same name and namespace in other branches
  1. 5.2 embed/ad_embed.module \ad_embed_admin_configure_settings_submit()
  2. 5 embed/ad_embed.module \ad_embed_admin_configure_settings_submit()
  3. 6.3 embed/ad_embed.module \ad_embed_admin_configure_settings_submit()
  4. 6 embed/ad_embed.module \ad_embed_admin_configure_settings_submit()
  5. 7 embed/ad_embed.module \ad_embed_admin_configure_settings_submit()

Save changes from module settings page.

File

embed/ad_embed.module, line 200
Embed ads in content.

Code

function ad_embed_admin_configure_settings_submit($form, &$form_state) {
  variable_set('ad_embed_replace_brackets', $form_state['values']['ad_embed_replace_brackets']);
  variable_set('ad_embed_replace_comments', $form_state['values']['ad_embed_replace_comments']);
  $types = node_get_types();
  foreach ($types as $key => $type) {
    variable_set("embed-ad-{$key}", $form_state['values']["embed-ad-{$key}"]);
    variable_set("embed-ad-{$key}-force", $form_state['values']["embed-ad-{$key}-force"]);
    if (isset($form_state['values']["embed-ad-{$key}-group"])) {
      variable_set("embed-ad-{$key}-group", implode(',', $form_state['values']["embed-ad-{$key}-group"]));
    }
    else {
      variable_set("embed-ad-{$key}-group", '');
    }
    variable_set("embed-ad-{$key}-count", $form_state['values']["embed-ad-{$key}-count"]);
    variable_set("embed-ad-{$key}-quantity", $form_state['values']["embed-ad-{$key}-quantity"]);
  }
  drupal_set_message(t('Embedded ad configuration options saved.'));
}