function ScaffoldFilePath::addInterpolationData

Same name in other branches
  1. 8.9.x composer/Plugin/Scaffold/ScaffoldFilePath.php \Drupal\Composer\Plugin\Scaffold\ScaffoldFilePath::addInterpolationData()
  2. 10 composer/Plugin/Scaffold/ScaffoldFilePath.php \Drupal\Composer\Plugin\Scaffold\ScaffoldFilePath::addInterpolationData()
  3. 11.x 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);
}

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