function Callback::transform
Overrides ProcessPluginBase::transform
File
-
core/
modules/ migrate/ src/ Plugin/ migrate/ process/ Callback.php, line 96
Class
- Callback
- Passes the source value to a callback.
Namespace
Drupal\migrate\Plugin\migrate\processCode
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
if (!empty($this->configuration['unpack_source'])) {
if (!is_array($value)) {
throw new MigrateException(sprintf("When 'unpack_source' is set, the source must be an array. Instead it was of type '%s'", gettype($value)));
}
return call_user_func($this->configuration['callable'], ...$value);
}
return call_user_func($this->configuration['callable'], $value);
}