function NullCoalesce::transform
Same name in other branches
- 9 core/modules/migrate/src/Plugin/migrate/process/NullCoalesce.php \Drupal\migrate\Plugin\migrate\process\NullCoalesce::transform()
- 8.9.x core/modules/migrate/src/Plugin/migrate/process/NullCoalesce.php \Drupal\migrate\Plugin\migrate\process\NullCoalesce::transform()
- 10 core/modules/migrate/src/Plugin/migrate/process/NullCoalesce.php \Drupal\migrate\Plugin\migrate\process\NullCoalesce::transform()
Overrides ProcessPluginBase::transform
File
-
core/
modules/ migrate/ src/ Plugin/ migrate/ process/ NullCoalesce.php, line 40
Class
- NullCoalesce
- Provides a Null Coalesce process plugin.
Namespace
Drupal\migrate\Plugin\migrate\processCode
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
if (!is_array($value)) {
throw new MigrateException("The input value should be an array.");
}
foreach ($value as $val) {
if (NULL !== $val) {
return $val;
}
}
if (isset($this->configuration['default_value'])) {
return $this->configuration['default_value'];
}
return NULL;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.