public function EntityLookup::transform in Migrate Plus 8.5
Same name and namespace in other branches
- 8.2 src/Plugin/migrate/process/EntityLookup.php \Drupal\migrate_plus\Plugin\migrate\process\EntityLookup::transform()
- 8.3 src/Plugin/migrate/process/EntityLookup.php \Drupal\migrate_plus\Plugin\migrate\process\EntityLookup::transform()
- 8.4 src/Plugin/migrate/process/EntityLookup.php \Drupal\migrate_plus\Plugin\migrate\process\EntityLookup::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
2 calls to EntityLookup::transform()
- DefaultEntityValue::transform in src/
Plugin/ migrate/ process/ DefaultEntityValue.php - Performs the associated process.
- EntityGenerate::transform in src/
Plugin/ migrate/ process/ EntityGenerate.php - Performs the associated process.
2 methods override EntityLookup::transform()
- DefaultEntityValue::transform in src/
Plugin/ migrate/ process/ DefaultEntityValue.php - Performs the associated process.
- EntityGenerate::transform in src/
Plugin/ migrate/ process/ EntityGenerate.php - Performs the associated process.
File
- src/
Plugin/ migrate/ process/ EntityLookup.php, line 169
Class
- EntityLookup
- This plugin looks for existing entities.
Namespace
Drupal\migrate_plus\Plugin\migrate\processCode
public function transform($value, MigrateExecutableInterface $migrateExecutable, Row $row, $destinationProperty) {
// If the source data is an empty array, return the same.
if (gettype($value) === 'array' && count($value) === 0) {
return [];
}
// In case of subfields ('field_reference/target_id'), extract the field
// name only.
$parts = explode('/', $destinationProperty);
$destinationProperty = reset($parts);
$this
->determineLookupProperties($destinationProperty);
$this->destinationProperty = isset($this->configuration['destination_field']) ? $this->configuration['destination_field'] : NULL;
return $this
->query($value);
}