You are here

private function Telemetry::getExtensionInfo in Lightning Core 8.3

Same name and namespace in other branches
  1. 8.4 modules/acquia_telemetry/src/Telemetry.php \Drupal\acquia_telemetry\Telemetry::getExtensionInfo()

Get an array of information about Lightning extensions.

Return value

array An array of extension info keyed by the extensions machine name. E.g., ['lightning_layout' => ['version' => '8.2.0', 'status' => 'enabled']].

1 call to Telemetry::getExtensionInfo()
Telemetry::createEvent in modules/acquia_telemetry/src/Telemetry.php
Creates an Amplitude event.

File

modules/acquia_telemetry/src/Telemetry.php, line 159

Class

Telemetry
Telemetry service.

Namespace

Drupal\acquia_telemetry

Code

private function getExtensionInfo() {
  $all_modules = $this->moduleList
    ->getAllAvailableInfo();
  $acquia_extensions = array_intersect_key($all_modules, array_flip($this
    ->getAcquiaExtensionNames()));
  $extension_info = [];
  foreach ($acquia_extensions as $name => $extension) {

    // Version is unset for dev versions. In order to generate reports, we
    // need some value for version, even if it is just the major version.
    $version = isset($extension['version']) ? $extension['version'] : $extension['core'];
    $extension_info[$name]['version'] = $version;
  }
  $installed_modules = $this->moduleList
    ->getAllInstalledInfo();
  foreach ($acquia_extensions as $name => $extension) {
    $extension_info[$name]['status'] = array_key_exists($name, $installed_modules) ? 'enabled' : 'disabled';
  }
  return $extension_info;
}