You are here

protected function Client::getSearchModulesData in Acquia Connector 8

Same name and namespace in other branches
  1. 8.2 src/Client.php \Drupal\acquia_connector\Client::getSearchModulesData()
  2. 3.x src/Client.php \Drupal\acquia_connector\Client::getSearchModulesData()

Get information on Acquia Search modules.

Return value

array|null Versions for enabled search modules, NULL otherwise.

1 call to Client::getSearchModulesData()
Client::getSubscription in src/Client.php
Get Acquia subscription from Acquia.

File

src/Client.php, line 208

Class

Client
Acquia connector client.

Namespace

Drupal\acquia_connector

Code

protected function getSearchModulesData() : ?array {

  // This is the only search module compatible with this version of Acquia
  // Connector for now.
  if (!\Drupal::moduleHandler()
    ->moduleExists('acquia_search')) {
    return NULL;
  }

  // Include Acquia Search Solr for Search API module version number.
  $modules = [
    'acquia_search',
    'search_api_solr',
  ];
  $result = [];
  foreach ($modules as $name) {
    $extension_list = \Drupal::service('extension.list.module');
    $info = $extension_list
      ->getExtensionInfo($name);

    // Send the version, or at least the core compatibility as a fallback.
    $result[$name] = isset($info['version']) ? (string) $info['version'] : (string) $info['core_version_requirement'];
  }
  return $result;
}