You are here

protected static function ProjectInfoTrait::getProjectName in Automatic Updates 7

Get the extension's project name.

Parameters

string $extension_name: The extension name.

array $info: The extension's info.

Return value

string The project name or fallback to extension name if project is undefined.

1 call to ProjectInfoTrait::getProjectName()
ProjectInfoTrait::getInfos in ./ProjectInfoTrait.php
Returns an array of info files information of available extensions.

File

./ProjectInfoTrait.php, line 53

Class

ProjectInfoTrait
Provide a helper to get project info.

Code

protected static function getProjectName($extension_name, array $info) {
  $project_name = $extension_name;
  if (isset($info['project'])) {
    $project_name = $info['project'];
  }
  if (strpos($info['install path'], 'modules') === 0) {
    $project_name = 'drupal';
  }
  if (strpos($info['install path'], 'themes') === 0) {
    $project_name = 'drupal';
  }
  return $project_name;
}