protected function EntityContentBase::getDefinitionFromEntity in Multiversion 8
Gets the field definition from a specific entity base field.
The method takes the field ID as an argument and returns the field storage definition to be used in getIds() by querying the destination entity base field definition.
Parameters
string $key: The field ID key.
Return value
array An associative array with a structure that contains the field type, keyed as 'type', together with field storage settings as they are returned by FieldStorageDefinitionInterface::getSettings().
Overrides EntityFieldDefinitionTrait::getDefinitionFromEntity
See also
\Drupal\Core\Field\FieldStorageDefinitionInterface::getSettings()
File
- src/
Plugin/ migrate/ destination/ EntityContentBase.php, line 102
Class
- EntityContentBase
- Migration destination class for content entities.
Namespace
Drupal\multiversion\Plugin\migrate\destinationCode
protected function getDefinitionFromEntity($key) {
$entity_type_id = $this->storage
->getEntityTypeId();
/** @var \Drupal\Core\Field\FieldStorageDefinitionInterface[] $definitions */
$definitions = $this->entityManager
->getBaseFieldDefinitions($entity_type_id);
$field_definition = $definitions[$key];
return [
'type' => $field_definition
->getType(),
] + $field_definition
->getSettings();
}