function google_admanager_admin_settings_form in DFP Small Business (Google Ad Manager) 6.2
Same name and namespace in other branches
- 5 google_admanager.module \google_admanager_admin_settings_form()
- 6.3 google_admanager.admin.inc \google_admanager_admin_settings_form()
- 6 google_admanager.module \google_admanager_admin_settings_form()
- 7.2 google_admanager.admin.inc \google_admanager_admin_settings_form()
Implementation of hook_admin_settings() for configuring the module.
2 string references to 'google_admanager_admin_settings_form'
- google_admanager_form_alter in ./
google_admanager.module - Implementation of hook_form_alter().
- google_admanager_menu in ./
google_admanager.module - Implementation of hook_menu().
File
- ./
google_admanager.admin.inc, line 48 - Admin functionality
Code
function google_admanager_admin_settings_form() {
$form = array();
$form['google_admanager_account'] = array(
'#type' => 'textfield',
'#title' => t('DFP Property Code'),
'#default_value' => variable_get('google_admanager_account', 'ca-pub-'),
'#size' => 30,
'#maxlength' => 40,
'#required' => TRUE,
'#description' => t('See detailed instruction in README.txt'),
);
$form['google_admanager_ad_slots'] = array(
'#type' => 'textarea',
'#title' => t('Ad slots'),
'#default_value' => variable_get('google_admanager_ad_slots', ''),
'#description' => t('Enter one Ad Slot name per line.'),
);
$form['google_admanager_noblock'] = array(
'#type' => 'checkbox',
'#title' => t('Don\'t create blocks'),
'#default_value' => variable_get('google_admanager_noblock', FALSE),
'#description' => t('This option allow you to use only superslot. Handful when you have dozens of ad slots or more. <strong>Switch on/off this option may reset blocks positions.</strong>'),
);
$form['google_admanager_lazy'] = array(
'#type' => 'checkbox',
'#title' => t('Lazy loading'),
'#default_value' => variable_get('google_admanager_lazy', FALSE),
'#description' => t('(Experimental) Insert DFP code before </body> instead of in header (not work with inline ad). Read more in README.txt'),
);
$form['google_admanager_autodetect'] = array(
'#type' => 'checkbox',
'#title' => t('Autodetect ad slot size'),
'#default_value' => variable_get('google_admanager_autodetect', FALSE),
'#description' => t('Auto detect ad slot size if name is in format <em>foo_??x??_bar</em> (e.g. <em>homepage_728x90_1</em>). Useful in lazy loading.'),
);
$form['google_admanager_nodetype_attributes'] = array(
'#type' => 'checkbox',
'#title' => t('Expose node type as atttribute'),
'#default_value' => variable_get('google_admanager_nodetype_attributes', FALSE),
'#description' => t('This option allows you to target whole content types as an attribute within Google Ad Manager'),
);
if (module_exists('taxonomy')) {
// Get an array of vocabularies
$vocabs = taxonomy_get_vocabularies();
// Build the form item defaults
$vocab_form_item = array(
'#title' => t('Expose vocabularies as attributes'),
'#description' => t('Enabling a vocabulary will allow you to target terms within the vocabulary from Google Ad Manager'),
);
// If vocabs are empty, insert a prompt form item
if (empty($vocabs)) {
$form['google_admanager_vocab_attributes'] = array(
'#type' => 'item',
'#value' => '<span class="error">' . t('You must have at least 1 vocabulary for this feature to work.') . '</span>',
) + $vocab_form_item;
}
else {
// Build a list of vocabularies as "vid => name" pairs
$options = array();
foreach ($vocabs as $v) {
$options[$v->vid] = $v->name;
}
// Create a form item of checkboxes
$form['google_admanager_vocab_attributes'] = array(
'#type' => 'checkboxes',
'#default_value' => variable_get('google_admanager_vocab_attributes', array()),
'#options' => $options,
) + $vocab_form_item;
}
}
return system_settings_form($form);
}