You are here

function acquia_search_install in Acquia Search 3.x

Same name and namespace in other branches
  1. 6.3 acquia_search.install \acquia_search_install()
  2. 6 acquia_search.install \acquia_search_install()
  3. 2.x acquia_search.install \acquia_search_install()

Implements hook_install().

File

./acquia_search.install, line 94
Install, update, and uninstall functions for the Acquia Search Solr module.

Code

function acquia_search_install() {

  // Import settings from the connector if it is installed and configured.
  $connector = \Drupal::moduleHandler()
    ->moduleExists('acquia_connector');
  $subscription = \Drupal::state()
    ->get('acquia_subscription_data');
  $storage = new Storage();
  if ($connector && isset($subscription)) {
    $storage
      ->setApiHost(\Drupal::config('acquia_search.settings')
      ->get('api_host') ?? 'https://api.sr-prod02.acquia.com');
    $storage
      ->setApiKey(\Drupal::state()
      ->get('acquia_connector.key'));
    $storage
      ->setIdentifier(\Drupal::state()
      ->get('acquia_connector.identifier'));
    $storage
      ->setUuid($subscription['uuid']);
  }
}