function ProjectInfo::getProjectName

ProjectInfo::getProjectName(Extension $file)

Determines what project a given file object belongs to.

Parameters

\Drupal\Core\Extension\Extension $file: An extension object.

Return value

string The canonical project short name.

File

core/lib/Drupal/Core/Utility/ProjectInfo.php, line 151

Class

ProjectInfo
Performs operations on drupal.org project data.

Namespace

Drupal\Core\Utility

Code

function getProjectName(Extension $file) {
  $project_name = '';
  if (isset($file->info['project'])) {
    $project_name = $file->info['project'];
  }
  elseif (strpos($file->getPath(), 'core/modules') === 0) {
    $project_name = 'drupal';
  }
  return $project_name;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Utility!ProjectInfo.php/function/ProjectInfo::getProjectName/8.1.x