You are here

function adsense_oldcode_block_configure in Google AdSense integration 7

Implements hook_block_configure().

File

old/oldcode/adsense_oldcode.module, line 72
Displays Google AdSense ads on Drupal pages.

Code

function adsense_oldcode_block_configure($delta) {
  $ad = _adsense_oldcode_get_block_config($delta);
  $ad_list = array();
  foreach (adsense_ad_formats(NULL, FALSE) as $format => $data) {
    $ad_list[$format] = $format . ' : ' . $data['desc'];
  }
  $group_list = array();
  for ($group = 1; $group <= ADSENSE_MAX_GROUPS; $group++) {
    $group_list[$group] = $group . ' : ' . variable_get('adsense_group_title_' . $group, ADSENSE_GROUP_TITLE_DEFAULT);
  }
  $channel_list[''] = t('None');
  for ($channel = 1; $channel <= ADSENSE_MAX_CHANNELS; $channel++) {
    $channel_list[$channel] = $channel . ' : ' . variable_get('adsense_ad_channel_' . $channel, ADSENSE_AD_CHANNEL_DEFAULT);
  }
  $form['info'] = array(
    '#type' => 'textfield',
    '#title' => t('Block description'),
    '#default_value' => $ad ? $ad[0] : '',
    '#maxlength' => 64,
    '#description' => t('A brief description of your block. Used on the <a href="@overview">block overview page</a>.', array(
      '@overview' => url('admin/structure/block'),
    )),
    '#required' => TRUE,
    '#weight' => -19,
  );
  $form['ad_format'] = array(
    '#type' => 'select',
    '#title' => t('Ad format'),
    '#default_value' => $ad ? $ad[1] : '250x250',
    '#options' => $ad_list,
    '#description' => t('Select the ad dimensions you want for this block.'),
  );
  $form['ad_group'] = array(
    '#type' => 'select',
    '#title' => t('Group'),
    '#default_value' => $ad ? $ad[2] : 1,
    '#options' => $group_list,
  );
  $form['ad_channel'] = array(
    '#type' => 'select',
    '#title' => t('Channel'),
    '#default_value' => $ad ? $ad[3] : 1,
    '#options' => $channel_list,
  );
  $form['ad_align'] = array(
    '#type' => 'select',
    '#title' => t('Ad alignment'),
    '#default_value' => $ad ? $ad[4] : 'center',
    '#options' => array(
      '' => t('None'),
      'left' => t('Left'),
      'center' => t('Centered'),
      'right' => t('Right'),
    ),
    '#description' => t('Select the horizontal alignment of the ad within the block.'),
  );
  return $form;
}