You are here

public function ScaffoldFilePath::addInterpolationData in Drupal 10

Same name and namespace in other branches
  1. 8 composer/Plugin/Scaffold/ScaffoldFilePath.php \Drupal\Composer\Plugin\Scaffold\ScaffoldFilePath::addInterpolationData()
  2. 9 composer/Plugin/Scaffold/ScaffoldFilePath.php \Drupal\Composer\Plugin\Scaffold\ScaffoldFilePath::addInterpolationData()

Adds data about the relative and full path to the provided interpolator.

Parameters

\Drupal\Composer\Plugin\Scaffold\Interpolator $interpolator: Interpolator to add data to.

string $name_prefix: (optional) Prefix to add before -rel-path and -full-path item names. Defaults to path type provided when constructing this object.

1 call to ScaffoldFilePath::addInterpolationData()
ScaffoldFilePath::getInterpolator in composer/Plugin/Scaffold/ScaffoldFilePath.php
Interpolate a string using the data from this scaffold file info.

File

composer/Plugin/Scaffold/ScaffoldFilePath.php, line 174

Class

ScaffoldFilePath
Manage the path to a file to scaffold.

Namespace

Drupal\Composer\Plugin\Scaffold

Code

public function addInterpolationData(Interpolator $interpolator, $name_prefix = '') {
  if (empty($name_prefix)) {
    $name_prefix = $this->type;
  }
  $data = [
    'package-name' => $this
      ->packageName(),
    "{$name_prefix}-rel-path" => $this
      ->relativePath(),
    "{$name_prefix}-full-path" => $this
      ->fullPath(),
  ];
  $interpolator
    ->addData($data);
}