You are here

public function SearchApiSolrAcquiaMultiSubsBackend::submitConfigurationForm in Acquia Search Multiple Indexes 8

Method to save the configuration.

We only save the index details, when the backend is overwritten, either by providing the exact index details manually, or when the user chose one of the available indices from the dropdown list.

In auto switch mode we only save the mode boolean flag.

File

src/Plugin/search_api/backend/SearchApiSolrAcquiaMultiSubsBackend.php, line 289

Class

SearchApiSolrAcquiaMultiSubsBackend
Plugin annotation @SearchApiBackend( id = "search_api_solr_acquia_multi_subs", label = @Translation("Acquia Solr Multi Sub"), description = @Translation("Index items using a specific Acquia Apache Solr search server.") )

Namespace

Drupal\acquia_search_multi_subs\Plugin\search_api\backend

Code

public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
  parent::submitConfigurationForm($form, $form_state);
  $values = $form_state
    ->getValues();

  // 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;

  //
  //    // Static override for the index, save the provided core information.
  //    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;
  //    }
}