function Handler::getPackageFileMappings

Same name in other branches
  1. 9 composer/Plugin/Scaffold/Handler.php \Drupal\Composer\Plugin\Scaffold\Handler::getPackageFileMappings()
  2. 10 composer/Plugin/Scaffold/Handler.php \Drupal\Composer\Plugin\Scaffold\Handler::getPackageFileMappings()
  3. 11.x composer/Plugin/Scaffold/Handler.php \Drupal\Composer\Plugin\Scaffold\Handler::getPackageFileMappings()

Gets the array of file mappings provided by a given package.

Parameters

\Composer\Package\PackageInterface $package: The Composer package from which to get the file mappings.

Return value

\Drupal\Composer\Plugin\Scaffold\Operations\OperationInterface[] An array of destination paths => scaffold operation objects.

1 call to Handler::getPackageFileMappings()
Handler::getFileMappingsFromPackages in composer/Plugin/Scaffold/Handler.php
Gets a consolidated list of file mappings from all allowed packages.

File

composer/Plugin/Scaffold/Handler.php, line 224

Class

Handler
Core class of the plugin.

Namespace

Drupal\Composer\Plugin\Scaffold

Code

protected function getPackageFileMappings(PackageInterface $package) {
    $options = $this->manageOptions
        ->packageOptions($package);
    if ($options->hasFileMapping()) {
        return $this->createScaffoldOperations($package, $options->fileMapping());
    }
    // Warn the user if they allow a package that does not have any scaffold
    // files. We will ignore drupal/core, though, as it is implicitly allowed,
    // but might not have scaffold files (version 8.7.x and earlier).
    if (!$options->hasAllowedPackages() && $package->getName() != 'drupal/core') {
        $this->io
            ->writeError("The allowed package {$package->getName()} does not provide a file mapping for Composer Scaffold.");
    }
    return [];
}

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