Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ProjectInfo.php

function ProjectInfo::getProjectName

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.

1 call to ProjectInfo::getProjectName()
ProjectInfo::processInfoList in core/lib/Drupal/Core/Utility/ProjectInfo.php
Populates an array of project data.

File

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

Class

ProjectInfo
Performs operations on drupal.org project data.

Namespace

Drupal\Core\Utility

Code

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

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal