You are here

function gss_settings in Google Site Search 7

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

Module settings.

1 call to gss_settings()
gss_search_admin in ./gss.module
Implements hook_search_admin().

File

./gss.module, line 11
GSS module file.

Code

function gss_settings() {
  $form = array();
  $form['gss'] = array(
    '#title' => t('Google Site Search'),
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['gss']['main'] = array(
    '#type' => 'fieldset',
    '#title' => t('Main'),
    '#weight' => -10,
    '#collapsible' => FALSE,
    '#collapsed' => FALSE,
  );
  $form['gss']['main']['gss_global'] = array(
    '#title' => t('Make Google Site Search global'),
    '#type' => 'checkbox',
    '#description' => t('Let Google Site Search take over all search functions on the site.'),
    '#default_value' => variable_get('gss_global', FALSE),
  );
  $form['gss']['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['gss']['main']['gss_autocomplete'] = array(
    '#title' => t('Add Google autocomplete to search boxes'),
    '#type' => 'checkbox',
    '#description' => t('Add Google autocomplete to search boxes.'),
    '#default_value' => variable_get('gss_autocomplete', FALSE),
  );
  $form['gss']['main']['gss_base_url'] = array(
    '#title' => t('Search engine base url'),
    '#type' => 'textfield',
    '#description' => t('The base URL to send the query to. Use this to override the default request to Google, useful for proxying the request.'),
    '#default_value' => variable_get('gss_base_url', ''),
  );
  $form['gss']['language'] = array(
    '#type' => 'fieldset',
    '#title' => t('Language'),
    '#weight' => -9,
    '#collapsible' => FALSE,
    '#collapsed' => FALSE,
  );
  $form['gss']['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['gss']['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['gss']['miscellaneous'] = array(
    '#type' => 'fieldset',
    '#title' => t('Miscellaneous'),
    '#weight' => -8,
    '#collapsible' => FALSE,
    '#collapsed' => FALSE,
  );
  $form['gss']['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', ''),
  );
  $gss_no_results = variable_get('gss_no_results', array(
    'value' => t('No results'),
    'format' => NULL,
  ));
  $form['gss']['miscellaneous']['gss_no_results'] = array(
    '#title' => t('No results'),
    '#type' => 'text_format',
    '#default_value' => $gss_no_results['value'],
    '#format' => $gss_no_results['format'],
    '#description' => t('Message to display when no search results are found. If provided, the "@query" token will be replaced with the search query.'),
  );
  $form['gss']['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['gss']['miscellaneous']['gss_pager_size'] = array(
    '#title' => t('Pager size'),
    '#type' => 'textfield',
    '#description' => t('Number of pages to show in the pager. Input 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['gss']['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),
  );
  $form['gss']['miscellaneous']['gss_number_of_results'] = array(
    '#title' => t('Show number of results'),
    '#type' => 'checkbox',
    '#description' => t('Show the line "Shows x to y of approximately x hits" in the top of the search result.'),
    '#default_value' => variable_get('gss_number_of_results', TRUE),
  );
  $form['gss']['miscellaneous']['gss_info'] = array(
    '#title' => t('Show extra information for each search result'),
    '#type' => 'checkbox',
    '#description' => t('Show extra information (content-type, author and date) below each search result.'),
    '#default_value' => variable_get('gss_info', FALSE),
  );
  $form['gss']['miscellaneous']['gss_full_pager'] = array(
    '#title' => t('Use full Pager'),
    '#type' => 'checkbox',
    '#description' => t('If checked, render full pager instead of mini pager.'),
    '#default_value' => variable_get('gss_full_pager', FALSE),
  );
  return $form;
}