function ProjectInfo::getAvailableProjects

Gets the available projects.

Return value

array The available projects keyed by project machine name in the format returned by update_get_available(). If the project specified in ::name is not returned from update_get_available() this project will be explicitly fetched and added the return value of this function.

See also

\update_get_available()

1 call to ProjectInfo::getAvailableProjects()
ProjectInfo::getProjectInfo in core/modules/package_manager/src/ProjectInfo.php
Returns up-to-date project information.

File

core/modules/package_manager/src/ProjectInfo.php, line 180

Class

ProjectInfo
Defines a class for retrieving project information from Update module.

Namespace

Drupal\package_manager

Code

private function getAvailableProjects() : array {
    $available_projects = update_get_available(TRUE);
    // update_get_available() will only returns projects that are in the active
    // codebase. If the project specified by ::name is not returned in
    // $available_projects, it means it is not in the active codebase, therefore
    // we will retrieve the project information from Package Manager's own
    // update processor service.
    if (!isset($available_projects[$this->name])) {
        
        /** @var \Drupal\package_manager\PackageManagerUpdateProcessor $update_processor */
        $update_processor = \Drupal::service(PackageManagerUpdateProcessor::class);
        if ($project_data = $update_processor->getProjectData($this->name)) {
            $available_projects[$this->name] = $project_data;
        }
    }
    return $available_projects;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.