public function ConverterBase::write in Drupal 7 to 8/9 Module Upgrader 8
Writes a file to the target module's directory.
Parameters
TargetInterface $target: The target module.
string $path: The path of the file to write, relative to the module root.
string $data: The file contents.
Return value
string The path of the file, including the target's base path.
3 calls to ConverterBase::write()
- ConverterBase::writeClass in src/
ConverterBase.php - Writes a class to the target module's PSR-4 root.
- UnitTests::convert in src/
Plugin/ DMU/ Converter/ UnitTests.php - Performs required conversions.
- VariableGet::convert in src/
Plugin/ DMU/ Converter/ Functions/ VariableGet.php - Performs required conversions.
File
- src/
ConverterBase.php, line 121
Class
- ConverterBase
- Base class for converters.
Namespace
Drupal\drupalmoduleupgraderCode
public function write(TargetInterface $target, $path, $data) {
static $fs;
if (empty($fs)) {
$fs = new Filesystem();
}
$destination_path = $target
->getPath($path);
$fs
->dumpFile($destination_path, (string) $data);
return $destination_path;
}