You are here

function adsense_cse_block_configure in Google AdSense integration 7

Implements hook_block_configure().

File

cse/adsense_cse.module, line 98
Displays Google AdSense ads on Drupal pages.

Code

function adsense_cse_block_configure($delta = '') {
  $ad = _adsense_cse_get_block_config($delta);
  $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_slot'] = array(
    '#type' => 'textfield',
    '#title' => t('Ad Slot ID'),
    '#default_value' => $ad ? $ad[1] : '',
    '#description' => t('This is the provided by the AdSense site in the Search Box Code "cx" field. This is usually provided in the form partner-<em>Publisher ID</em>:<em>Slot Id</em>. If the code provided is, for example, partner-pub-0123456789:<strong>abcdefghij</strong>, then insert only <strong>abcdefghij</strong> here.'),
    '#required' => TRUE,
  );

  // If the block has already been saved, but the version is not set, that
  // means it's a version 1, otherwise set to the latest version (2).
  $default = $ad ? isset($ad[2]) ? $ad[2] : '1' : '2';
  $form['version'] = array(
    '#type' => 'radios',
    '#title' => t('CSE version'),
    '#default_value' => $default,
    '#options' => array(
      '1' => t('Version 1'),
      '2' => t('Version 2'),
    ),
    '#description' => t('CSE version. If unsure, choose %default.', array(
      '%default' => 'Version 2',
    )),
    '#required' => TRUE,
  );
  return $form;
}