public function ProcessField::transform in Drupal 8
Same name and namespace in other branches
- 9 core/modules/field/src/Plugin/migrate/process/ProcessField.php \Drupal\field\Plugin\migrate\process\ProcessField::transform()
- 10 core/modules/field/src/Plugin/migrate/process/ProcessField.php \Drupal\field\Plugin\migrate\process\ProcessField::transform()
Performs the associated process.
Parameters
mixed $value: The value to be transformed.
\Drupal\migrate\MigrateExecutableInterface $migrate_executable: The migration in which this process is being executed.
\Drupal\migrate\Row $row: The row from the source to process. Normally, just transforming the value is adequate but very rarely you might need to change two columns at the same time or something like that.
string $destination_property: The destination property currently worked on. This is only used together with the $row above.
Return value
string|array The newly transformed value.
Overrides ProcessPluginBase::transform
File
- core/
modules/ field/ src/ Plugin/ migrate/ process/ ProcessField.php, line 108
Class
- ProcessField
- Get the value from a method call on a field plugin instance.
Namespace
Drupal\field\Plugin\migrate\processCode
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
if (!is_string($value)) {
throw new MigrateException('The input value must be a string.');
}
if (empty($this->configuration['method'])) {
throw new MigrateException('You need to specify the name of a method to be called on the Field plugin.');
}
$method = $this->configuration['method'];
try {
return $this
->callMethodOnFieldPlugin($this->fieldPluginManager, $value, $method, $row);
} catch (PluginNotFoundException $e) {
try {
return $this
->callMethodOnFieldPlugin($this->cckPluginManager, $value, $method, $row);
} catch (PluginNotFoundException $e) {
return NULL;
}
}
}