function EntityExists::transform
Same name in other branches
- 9 core/modules/migrate/src/Plugin/migrate/process/EntityExists.php \Drupal\migrate\Plugin\migrate\process\EntityExists::transform()
- 8.9.x core/modules/migrate/src/Plugin/migrate/process/EntityExists.php \Drupal\migrate\Plugin\migrate\process\EntityExists::transform()
- 11.x core/modules/migrate/src/Plugin/migrate/process/EntityExists.php \Drupal\migrate\Plugin\migrate\process\EntityExists::transform()
Overrides ProcessPluginBase::transform
File
-
core/
modules/ migrate/ src/ Plugin/ migrate/ process/ EntityExists.php, line 68
Class
- EntityExists
- This plugin checks if a given entity exists.
Namespace
Drupal\migrate\Plugin\migrate\processCode
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
if (is_array($value)) {
$value = reset($value);
}
$entity = $this->storage
->load($value);
if ($entity instanceof EntityInterface) {
return $entity->id();
}
return FALSE;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.