public function SearchApiAcquiaSearchMultiService::configurationFormValidate in Acquia Search Multiple Indexes 7
Same name and namespace in other branches
- 8 src/Plugin/search_api/backend/SearchApiAcquiaSearchMultiService.php \SearchApiAcquiaSearchMultiService::configurationFormValidate()
Overrides SearchApiSolrService::configurationFormValidate().
Verifies the subscription if the user has specified an subscription_id and a subscription_key by switching off auto-selection of core-name and choosing the "other" option in the list of cores-names.
File
- lib/
Drupal/ SearchApiSolr/ SearchApiAcquiaSearchMultiService.php, line 129 - Contains SearchApiAcquiaSearchMultiService.
Class
- SearchApiAcquiaSearchMultiService
- Provides automatic environment switching for Acquia Search servers.
Code
public function configurationFormValidate(array $form, array &$values, array &$form_state) {
parent::configurationFormValidate($form, $values, $form_state);
$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'];
// Make sure that we'll have cached subscription in submit.
$subscription = $this
->getAcquiaSubscription($identifier, $key);
if ($error_message = $this
->getAcquiaSubscriptionError($subscription, $identifier, TRUE)) {
// Error message already displayed by the getAcquiaSubscription.
form_set_error('options][form][acquia_override_subscription][acquia_override_subscription_key');
form_set_error('options][form][acquia_override_subscription][acquia_override_subscription_id');
}
}
}