You are here

function adsense_cse_settings in Google AdSense integration 7

Same name and namespace in other branches
  1. 5.3 cse/adsense_cse.admin.inc \adsense_cse_settings()
  2. 6 cse/adsense_cse.admin.inc \adsense_cse_settings()

Menu callback for the adsense_cse module settings form.

1 string reference to 'adsense_cse_settings'
adsense_cse_menu in cse/adsense_cse.module
Implements hook_menu().

File

cse/adsense_cse.admin.inc, line 16
Contains the administrative functions of the adsense_cse module.

Code

function adsense_cse_settings() {
  module_load_include('inc', 'adsense_cse', 'help/adsense_cse.help');
  module_load_include('inc', 'adsense', 'includes/adsense.search_options');
  $form['help'] = array(
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#title' => t('Help and instructions'),
  );
  $form['help']['help'] = array(
    '#markup' => adsense_cse_help_text(),
  );
  $form['csev1'] = array(
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#title' => t('CSE v1'),
  );
  $form['csev1']['searchbox'] = array(
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
    '#title' => t('Search Box Options'),
  );
  $form['csev1']['searchbox']['adsense_cse_logo'] = array(
    '#type' => 'radios',
    '#title' => t('Logo Type'),
    '#default_value' => variable_get('adsense_cse_logo', ADSENSE_CSE_LOGO_DEFAULT),
    '#options' => array(
      'adsense_cse_branding_watermark' => t('Watermark on search box (requires JavaScript)'),
      'adsense_cse_branding_right' => t('Next to the search box'),
      'adsense_cse_branding_bottom' => t('Below the search box'),
    ),
  );
  $form['csev1']['searchbox']['adsense_cse_color_box_background'] = array(
    '#type' => 'select',
    '#title' => t('Background color'),
    '#default_value' => variable_get('adsense_cse_color_box_background', ADSENSE_CSE_COLOR_BOX_BACKGROUND_DEFAULT),
    '#options' => array(
      'FFFFFF' => t('White'),
      '999999' => t('Gray'),
      '000000' => t('Black'),
    ),
  );
  $form['csev1']['searchbox']['adsense_cse_encoding'] = array(
    '#type' => 'select',
    '#title' => t('Site Encoding'),
    '#default_value' => variable_get('adsense_cse_encoding', ADSENSE_CSE_ENCODING_DEFAULT),
    '#options' => _adsense_search_options_encoding(),
  );
  $form['csev1']['searchbox']['adsense_cse_textbox_length'] = array(
    '#type' => 'textfield',
    '#title' => t('Text Box Length'),
    '#default_value' => variable_get('adsense_cse_textbox_length', ADSENSE_CSE_TEXTBOX_LENGTH_DEFAULT),
    '#size' => 2,
    '#maxlength' => 2,
  );
  $form['csev1']['searchbox']['adsense_cse_language'] = array(
    '#type' => 'select',
    '#title' => t('Watermark Language'),
    '#default_value' => variable_get('adsense_cse_language', ADSENSE_CSE_LANGUAGE_DEFAULT),
    '#options' => _adsense_search_options_language(),
  );
  $form['csev1']['result'] = array(
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
    '#title' => t('Search Results Style'),
  );
  $form['csev1']['result']['adsense_cse_country'] = array(
    '#type' => 'select',
    '#title' => t('Country or territory for Google domain'),
    '#default_value' => variable_get('adsense_cse_country', ADSENSE_CSE_COUNTRY_DEFAULT),
    '#options' => _adsense_search_options_country(),
  );
  $form['csev1']['result']['adsense_cse_frame_width'] = array(
    '#type' => 'textfield',
    '#title' => t('Width of results area'),
    '#default_value' => variable_get('adsense_cse_frame_width', ADSENSE_CSE_FRAME_WIDTH_DEFAULT),
    '#size' => 3,
    '#maxlength' => 4,
  );
  $form['csev1']['result']['adsense_cse_ad_location'] = array(
    '#type' => 'radios',
    '#title' => t('Ad Location'),
    '#default_value' => variable_get('adsense_cse_ad_location', ADSENSE_CSE_AD_LOCATION_DEFAULT),
    '#options' => array(
      'adsense_cse_loc_top_right' => t('Top and Right'),
      'adsense_cse_loc_top_bottom' => t('Top and Bottom'),
      'adsense_cse_loc_right' => t('Right'),
    ),
  );
  $form['blocks'] = array(
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
    '#title' => t('AdSense Blocks'),
  );
  $form['blocks']['adsense_cse_number_blocks'] = array(
    '#type' => 'textfield',
    '#title' => t('Number of blocks'),
    '#default_value' => variable_get('adsense_cse_number_blocks', ADSENSE_CSE_NUMBER_BLOCKS_DEFAULT),
    '#size' => 2,
    '#maxlength' => 2,
  );
  $form['#validate'][] = '_adsense_cse_settings_validate';
  return system_settings_form($form);
}