function ad_embed_admin_configure_settings in Advertisement 6
Same name and namespace in other branches
- 5.2 embed/ad_embed.module \ad_embed_admin_configure_settings()
- 5 embed/ad_embed.module \ad_embed_admin_configure_settings()
- 6.3 embed/ad_embed.module \ad_embed_admin_configure_settings()
- 6.2 embed/ad_embed.module \ad_embed_admin_configure_settings()
- 7 embed/ad_embed.module \ad_embed_admin_configure_settings()
Module settings page.
1 string reference to 'ad_embed_admin_configure_settings'
- ad_embed_menu in embed/
ad_embed.module - Implementation of hook_menu().
File
- embed/
ad_embed.module, line 97 - Embed ads in content.
Code
function ad_embed_admin_configure_settings($form_state) {
$form = array();
$form['manual'] = array(
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#title' => t('Manually embedded ads'),
'#description' => t('Configuration options for manually embedded ads using [[ad]] and <!--ad--> tags.'),
);
$form['manual']['ad_embed_replace_brackets'] = array(
'#type' => 'checkbox',
'#title' => t('Replace ad bracket tags'),
'#default_value' => variable_get('ad_embed_replace_brackets', 1),
'#description' => t('Replace [[ad]] style tags in site content with advertisements.'),
);
$form['manual']['ad_embed_replace_comments'] = array(
'#type' => 'checkbox',
'#title' => t('Replace ad comment tags'),
'#default_value' => variable_get('ad_embed_replace_comments', 1),
'#description' => t('Replace <!--ad--> style tags in site content with advertisements.'),
);
$form['automatic'] = array(
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#title' => t('Automatically embedded ads'),
'#description' => t('Enable automatically embedded ads for any of the following content types, causing ads to be automatically inserted when users are viewing the content. Configure where the ad should be placed, from which ad group(s) the ads should be selected, and how many ads to display.'),
);
$types = node_get_types();
foreach ($types as $key => $type) {
$form['automatic'][$key] = array(
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#collapsed' => variable_get("embed-ad-{$key}", 0) ? FALSE : TRUE,
'#title' => $type->name,
);
$form['automatic'][$key]["embed-ad-{$key}"] = array(
'#type' => 'checkbox',
'#title' => t('Automatically embed ads in %type content', array(
'%type' => $type->name,
)),
'#default_value' => variable_get("embed-ad-{$key}", 0),
);
$form['automatic'][$key]["embed-ad-{$key}-count"] = array(
'#type' => 'select',
'#title' => t('Location', array(
'%type' => $type->name,
)),
'#options' => array(
0 => t('Before the first paragraph'),
1 => t('After the first paragraph'),
2 => t('After the second paragraph'),
3 => t('After the third paragraph'),
4 => t('After the fourth paragraph'),
5 => t('After the fifth paragraph'),
6 => t('After the sixth paragraph'),
7 => t('After the seventh paragraph'),
8 => t('After the eighth paragraph'),
9 => t('After the ninth paragraph'),
10 => t('After the tenth paragraph'),
-1 => t('After the last paragraph'),
),
'#default_value' => variable_get("embed-ad-{$key}-count", array()),
'#description' => t('Specify where you would like to automatically embed the advertisement for this content type.'),
);
$form['automatic'][$key]["embed-ad-{$key}-force"] = array(
'#type' => 'checkbox',
'#title' => t('Always display ad'),
'#default_value' => variable_get("embed-ad-{$key}-force", 0),
'#description' => t('Check this box to display an ad even if the content doesn\'t have as many paragraphs as you specified above. In these cases the ad will appear at the end of the content.'),
);
$form['automatic'][$key]["embed-ad-{$key}-group"] = array(
'#type' => 'select',
'#multiple' => TRUE,
'#title' => t('Ad group'),
'#options' => ad_groups_list(FALSE),
'#default_value' => explode(',', variable_get("embed-ad-{$key}-group", '')),
'#description' => t('Specify from which ad group(s) you\'d like to display advertisements.'),
);
$form['automatic'][$key]["embed-ad-{$key}-quantity"] = array(
'#type' => 'select',
'#title' => t('Quantity'),
'#options' => drupal_map_assoc(array(
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
)),
'#default_value' => variable_get("embed-ad-{$key}-quantity", 1),
'#description' => t('Specify how many advertisements to display at the same time.'),
);
}
$form['save'] = array(
'#type' => 'submit',
'#value' => t('Save'),
);
return $form;
}