You are here

function _google_appliance_get_settings in Google Search Appliance 7

Returns all module settings for the Google Appliance module.

Return value

array An associative array of module settings keyed by $field_keys.

16 calls to _google_appliance_get_settings()
google_appliance_admin_settings in ./google_appliance.admin.inc
Implements hook_admin_settings(). displays the Search Google Appliance module settings page.
google_appliance_block_form_submit in ./google_appliance.module
Submit handler for block search form just sets the redirect for the form based on the search query
google_appliance_block_info in ./google_appliance.module
Implements hook_block_info().
google_appliance_block_view_alter in ./google_appliance.module
Implements hook_block_view_alter().
google_appliance_block_visibility_submit in ./google_appliance.module
Submit handler to save block-specific crawler visibility settings.

... See full list

File

./google_appliance.helpers.inc, line 41
helper functions for the Search Google Appliance module

Code

function _google_appliance_get_settings() {
  $field_keys = array(
    'hostname',
    'collection',
    'frontend',
    'timeout',
    'autofilter',
    'language_filter_toggle',
    'language_filter_options',
    'query_inspection',
    'search_title',
    'results_per_page',
    'advanced_search_reporting',
    'spelling_suggestions',
    'onebox_modules',
    'block_visibility_settings',
    'sitelinks_search_box',
    'drupal_path',
    'error_gsa_no_results',
    'error_gsa_no_results_format',
    'error_curl_error',
    'error_curl_error_format',
    'error_lib_xml_parse_error',
    'error_lib_xml_parse_error_format',
  );

  // Settings fall back to default constants.
  foreach ($field_keys as $field) {
    $settings[$field] = variable_get('google_appliance_' . $field, constant('SGA_DEFAULT_' . strtoupper($field)));
  }

  // Convert onebox_modules from string to array.
  $settings['onebox_modules'] = explode("\n", $settings['onebox_modules']);
  $settings['onebox_modules'] = array_map('trim', $settings['onebox_modules']);
  $settings['onebox_modules'] = array_filter($settings['onebox_modules'], 'strlen');

  // The empty string in the define block above for block visibility
  // settings is really just a flag that nothing has been set yet.
  // Using an empty string is problematic, so we just set it to an
  // empty array instead.
  if ($settings['block_visibility_settings'] === '') {
    $settings['block_visibility_settings'] = array();
  }
  if ($settings['language_filter_options'] === '') {
    $settings['language_filter_options'] = array();
  }
  return $settings;
}