You are here

function gss_settings in Google Site Search 6

Same name and namespace in other branches
  1. 7 gss.module \gss_settings()

Module settings.

1 string reference to 'gss_settings'
gss_menu in ./gss.module
Implementation of hook_menu().

File

./gss.module, line 40

Code

function gss_settings() {
  $form = array();
  $form['main'] = array(
    '#type' => 'fieldset',
    '#title' => t('Main'),
    '#weight' => -10,
    '#collapsible' => FALSE,
    '#collapsed' => FALSE,
  );
  $form['main']['gss_enabled'] = array(
    '#title' => t('Enable Google Site Search'),
    '#type' => 'checkbox',
    '#description' => t('This will show "Google Search" or custom tab in the search page. It will also make Google Site Search to default in the site search.'),
    '#default_value' => variable_get('gss_enabled', FALSE),
  );
  $form['main']['gss_api_key'] = array(
    '#title' => t('Search engine unique ID'),
    '#type' => 'textfield',
    '#description' => t('Your Search engine unique ID. If no ID is given, the module will not work and will be disabled.'),
    '#default_value' => variable_get('gss_api_key', ''),
  );
  $form['language'] = array(
    '#type' => 'fieldset',
    '#title' => t('Language'),
    '#weight' => -9,
    '#collapsible' => FALSE,
    '#collapsed' => FALSE,
  );
  $form['language']['gss_language'] = array(
    '#title' => t('Language'),
    '#type' => 'textfield',
    '#description' => t('The language to search. Write the language code with two letters.<br />Ex: for "english", input "en"; for "Chinese (Simplified)", input "zh-CN".'),
    '#default_value' => variable_get('gss_language', FALSE),
    '#size' => 5,
    '#max_length' => 5,
  );
  $form['language']['gss_default_language'] = array(
    '#title' => t('Use current site language'),
    '#type' => 'checkbox',
    '#description' => t('This setting will override the custom language above.'),
    '#default_value' => variable_get('gss_default_language', FALSE),
  );
  $form['miscellaneous'] = array(
    '#type' => 'fieldset',
    '#title' => t('Miscellaneous'),
    '#weight' => -8,
    '#collapsible' => FALSE,
    '#collapsed' => FALSE,
  );
  $form['miscellaneous']['gss_results_tab'] = array(
    '#title' => t('Search results tab name'),
    '#type' => 'textfield',
    '#maxlength' => 50,
    '#size' => 60,
    '#description' => t('Enter a custom name of the tab where search results are displayed (defaults to %google).', array(
      '%google' => t('Google Search'),
    )),
    '#default_value' => variable_get('gss_results_tab', ''),
  );
  $form['miscellaneous']['gss_page_size'] = array(
    '#title' => t('Page size'),
    '#type' => 'textfield',
    '#description' => t('Number of results to display per page.'),
    '#default_value' => variable_get('gss_page_size', 20),
    '#size' => 5,
    '#max_length' => 5,
  );
  $form['miscellaneous']['gss_pager_size'] = array(
    '#title' => t('Pager size'),
    '#type' => 'textfield',
    '#description' => t('Number of pages to show in the pager. Imput ONLY odd numbers like 5, 7 or 9 and NOT 6, 8 or 10, for example.'),
    '#default_value' => variable_get('gss_pager_size', 19),
    '#size' => 5,
    '#max_length' => 5,
  );
  $form['miscellaneous']['gss_labels'] = array(
    '#title' => t('Show labels'),
    '#type' => 'checkbox',
    '#description' => t('Let the user filter the search result by labels. <a href="@link">Click here</a> to read more about search labels.', array(
      '@link' => url('https://developers.google.com/custom-search/docs/ref_prebuiltlabels'),
    )),
    '#default_value' => variable_get('gss_labels', TRUE),
  );
  return system_settings_form($form);
}