You are here

protected function ProjectInfoTrait::getExtensionVersion in Automatic Updates 8

Get the extension version.

Parameters

array $info: The extension's info.

Return value

string|null The version or NULL if undefined.

2 calls to ProjectInfoTrait::getExtensionVersion()
ProjectInfoTestClass::getExtensionVersion in tests/src/Kernel/ProjectInfoTraitTest.php
ProjectInfoTrait::getInfos in src/ProjectInfoTrait.php
Returns an array of info files information of available extensions.

File

src/ProjectInfoTrait.php, line 73

Class

ProjectInfoTrait
Provide a helper to get project info.

Namespace

Drupal\automatic_updates

Code

protected function getExtensionVersion(array $info) {
  $extension_name = $info['project'];
  if (isset($info['version']) && strpos($info['version'], '-dev') === FALSE) {
    return $info['version'];
  }

  // Handle experimental modules from core.
  if (strpos($info['install path'], 'core') === 0) {
    return $this
      ->getExtensionList('module')
      ->get('system')->info['version'];
  }
  \Drupal::logger('automatic_updates')
    ->error('Version cannot be located for @extension', [
    '@extension' => $extension_name,
  ]);
  return NULL;
}