function DefaultValue::transform
Same name in other branches
- 8.9.x core/modules/migrate/src/Plugin/migrate/process/DefaultValue.php \Drupal\migrate\Plugin\migrate\process\DefaultValue::transform()
- 10 core/modules/migrate/src/Plugin/migrate/process/DefaultValue.php \Drupal\migrate\Plugin\migrate\process\DefaultValue::transform()
- 11.x core/modules/migrate/src/Plugin/migrate/process/DefaultValue.php \Drupal\migrate\Plugin\migrate\process\DefaultValue::transform()
Overrides ProcessPluginBase::transform
File
-
core/
modules/ migrate/ src/ Plugin/ migrate/ process/ DefaultValue.php, line 54
Class
- DefaultValue
- Returns a given default value if the input is empty.
Namespace
Drupal\migrate\Plugin\migrate\processCode
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
if (!empty($this->configuration['strict'])) {
return $value ?? $this->configuration['default_value'];
}
return $value ?: $this->configuration['default_value'];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.