public function SearchApiAcquiaSearchMultiService::configurationFormSubmit in Acquia Search Multiple Indexes 8
Same name and namespace in other branches
- 7 lib/Drupal/SearchApiSolr/SearchApiAcquiaSearchMultiService.php \SearchApiAcquiaSearchMultiService::configurationFormSubmit()
Overrides SearchApiSolrService::configurationFormSubmit().
If auto detection is not on, changes our search core name to the one that was inputted.
File
- src/
Plugin/ search_api/ backend/ SearchApiAcquiaSearchMultiService.php, line 156 - Contains SearchApiAcquiaSearchMultiService.
Class
- SearchApiAcquiaSearchMultiService
- Provides automatic environment switching for Acquia Search servers.
Code
public function configurationFormSubmit(array $form, array &$values, array &$form_state) {
parent::configurationFormSubmit($form, $values, $form_state);
// If we do not have auto switch enabled, statically configure the right
// core to options.
$has_id = isset($values['acquia_override_subscription']['acquia_override_subscription_id']) ? true : false;
$has_key = isset($values['acquia_override_subscription']['acquia_override_subscription_key']) ? true : false;
$has_corename = isset($values['acquia_override_subscription']['acquia_override_subscription_corename']) ? true : false;
$has_auto_switch = !empty($values['acquia_override_subscription']['acquia_override_auto_switch']) ? true : false;
if (!$has_auto_switch && $has_id && $has_key && $has_corename) {
$identifier = $values['acquia_override_subscription']['acquia_override_subscription_id'];
$key = $values['acquia_override_subscription']['acquia_override_subscription_key'];
$corename = $values['acquia_override_subscription']['acquia_override_subscription_corename'];
// Set our solr path
$this->options['path'] = '/solr/' . $corename;
// Set the derived key for this environment.
// Subscription already cached by configurationFormValidate().
$subscription = $this
->getAcquiaSubscription($identifier, $key);
$derived_key_salt = $subscription['derived_key_salt'];
$derived_key = _acquia_search_multi_subs_create_derived_key($derived_key_salt, $corename, $key);
$this->options['derived_key'] = $derived_key;
$search_host = acquia_search_multi_subs_get_hostname($corename);
$this->options['host'] = $search_host;
}
}