function AllowedPackages::getAllowedPackages
Same name in other branches
- 9 composer/Plugin/Scaffold/AllowedPackages.php \Drupal\Composer\Plugin\Scaffold\AllowedPackages::getAllowedPackages()
- 8.9.x composer/Plugin/Scaffold/AllowedPackages.php \Drupal\Composer\Plugin\Scaffold\AllowedPackages::getAllowedPackages()
- 10 composer/Plugin/Scaffold/AllowedPackages.php \Drupal\Composer\Plugin\Scaffold\AllowedPackages::getAllowedPackages()
Gets a list of all packages that are allowed to copy scaffold files.
We will implicitly allow the projects 'drupal/legacy-scaffold-assets' and 'drupal/core' to scaffold files, if they are present. Any other project must be explicitly whitelisted in the top-level composer.json file in order to be allowed to override scaffold files. Configuration for packages specified later will override configuration specified by packages listed earlier. In other words, the last listed package has the highest priority. The root package will always be returned at the end of the list.
Return value
\Composer\Package\PackageInterface[] An array of allowed Composer packages.
File
-
composer/
Plugin/ Scaffold/ AllowedPackages.php, line 79
Class
- AllowedPackages
- Determine recursively which packages have been allowed to scaffold files.
Namespace
Drupal\Composer\Plugin\ScaffoldCode
public function getAllowedPackages() {
$top_level_packages = $this->getTopLevelAllowedPackages();
$allowed_packages = $this->recursiveGetAllowedPackages($top_level_packages);
// If the root package defines any file mappings, then implicitly add it
// to the list of allowed packages. Add it at the end so that it overrides
// all the preceding packages.
if ($this->manageOptions
->getOptions()
->hasFileMapping()) {
$root_package = $this->composer
->getPackage();
unset($allowed_packages[$root_package->getName()]);
$allowed_packages[$root_package->getName()] = $root_package;
}
// Handle any newly-added packages that are not already allowed.
return $this->evaluateNewPackages($allowed_packages);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.