You are here

function google_appliance_block_visibility_submit in Google Search Appliance 7

Submit handler to save block-specific crawler visibility settings.

1 string reference to 'google_appliance_block_visibility_submit'
google_appliance_form_block_admin_configure_alter in ./google_appliance.module
Implements hook_form_FORM_ID_alter().

File

./google_appliance.module, line 337
Google Appliance module enables searching via a dedicated Google Search Appliance hardware device. See README.txt and the help page at admin/help/google_appliance.

Code

function google_appliance_block_visibility_submit($form, &$form_state) {
  $settings = _google_appliance_get_settings();
  $module = $form_state['values']['module'];
  $delta = $form_state['values']['delta'];

  // Clear out our block settings array if no restrictions are applied.
  // @TODO: clean up array keys with empty values, i.e., those that once
  // had settings for block visibility, but have been reverted to none.
  if ($form_state['values']['crawler'] == 'none') {
    if (isset($settings['block_visibility_settings'][$module][$delta])) {
      unset($settings['block_visibility_settings'][$module][$delta]);
    }
  }
  else {
    $settings['block_visibility_settings'][$module][$delta] = $form_state['values']['crawler'];
  }

  // Save the settings.
  variable_set('google_appliance_block_visibility_settings', $settings['block_visibility_settings']);
}