function simpleads_block_configure in SimpleAds 7
Same name and namespace in other branches
- 7.2 includes/blocks.inc \simpleads_block_configure()
Implements hook_block_configure().
File
- ./
simpleads.module, line 274
Code
function simpleads_block_configure($delta = '') {
$form = array();
$max_ads = variable_get('simpleads_max_ads_per_block', 25);
$options = array();
for ($i = 1; $i <= $max_ads; $i++) {
$options[$i] = $i;
}
$result = db_select('simpleads_blocks', 'sb')
->fields('sb')
->execute();
foreach ($result as $block) {
$data = unserialize($block->settings);
if ($data['block_delta'] == $delta) {
$form['ads_limit'] = array(
'#type' => 'select',
'#title' => t('Number of ads to display'),
'#default_value' => $data['ads_limit'],
'#options' => $options,
);
$form['ads_page'] = array(
'#type' => 'textfield',
'#title' => t('Advertise page'),
'#default_value' => check_plain($data['ads_page']),
);
$form['ads_width'] = array(
'#type' => 'textfield',
'#title' => t('Ad width'),
'#default_value' => check_plain($data['ads_width']),
);
$form['ads_height'] = array(
'#type' => 'textfield',
'#title' => t('Ad height'),
'#default_value' => check_plain($data['ads_height']),
);
$order_options = array();
$order_options_all = module_invoke_all('simpleads_order_info');
if (count($order_options_all) > 0) {
foreach ($order_options_all as $delta => $name) {
$order_options[$delta] = check_plain($name);
}
}
$form['ads_order'] = array(
'#type' => 'select',
'#title' => t('Ads order'),
'#default_value' => isset($data['ads_order']) ? $data['ads_order'] : 'random',
'#options' => $order_options,
);
$effects = _simpleads_rotation_effects();
$form['ads_rotation_type'] = array(
'#type' => 'select',
'#title' => t('Ads auto rotation type'),
'#default_value' => isset($data['ads_rotation_type']) ? $data['ads_rotation_type'] : 0,
'#options' => $effects,
'#prefix' => '<div id="ads_rotation_settings">',
);
$form['ads_rotation_delay'] = array(
'#type' => 'textfield',
'#title' => t('Ad rotation delay'),
'#default_value' => isset($data['ads_rotation_delay']) ? check_plain($data['ads_rotation_delay']) : 10,
'#description' => t('Delay value is in seconds'),
'#suffix' => '</div>',
);
}
}
return $form;
}