protected function EntityGenerate::entity in Migrate Plus 8.3
Same name and namespace in other branches
- 8.5 src/Plugin/migrate/process/EntityGenerate.php \Drupal\migrate_plus\Plugin\migrate\process\EntityGenerate::entity()
- 8.2 src/Plugin/migrate/process/EntityGenerate.php \Drupal\migrate_plus\Plugin\migrate\process\EntityGenerate::entity()
- 8.4 src/Plugin/migrate/process/EntityGenerate.php \Drupal\migrate_plus\Plugin\migrate\process\EntityGenerate::entity()
Fabricate an entity.
This is intended to be extended by implementing classes to provide for more dynamic default values, rather than just static ones.
Parameters
$value: Primary value to use in creation of the entity.
Return value
array Entity value array.
1 call to EntityGenerate::entity()
- EntityGenerate::generateEntity in src/
Plugin/ migrate/ process/ EntityGenerate.php - Generates an entity for a given value.
File
- src/
Plugin/ migrate/ process/ EntityGenerate.php, line 84
Class
- EntityGenerate
- This plugin generates entities within the process plugin.
Namespace
Drupal\migrate_plus\Plugin\migrate\processCode
protected function entity($value) {
$entity_values = [
$this->lookupValueKey => $value,
];
if ($this->lookupBundleKey) {
$entity_values[$this->lookupBundleKey] = $this->lookupBundle;
}
// Gather any static default values for properties/fields.
if (isset($this->configuration['default_values']) && is_array($this->configuration['default_values'])) {
foreach ($this->configuration['default_values'] as $key => $value) {
$entity_values[$key] = $value;
}
}
return $entity_values;
}