You are here

protected function SourcePluginBase::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().

See also

\Drupal\Core\Field\FieldStorageDefinitionInterface::getSettings()

1 call to SourcePluginBase::getDefinitionFromEntity()
SourcePluginBase::getIds in src/Plugin/migrate/source/SourcePluginBase.php
Defines the source fields uniquely identifying a source row.

File

src/Plugin/migrate/source/SourcePluginBase.php, line 102

Class

SourcePluginBase

Namespace

Drupal\multiversion\Plugin\migrate\source

Code

protected function getDefinitionFromEntity($key) {

  /** @var \Drupal\Core\Field\FieldStorageDefinitionInterface[] $definitions */
  $definitions = $this->entityManager
    ->getBaseFieldDefinitions($this->entityTypeId);
  $field_definition = $definitions[$key];
  return [
    'type' => $field_definition
      ->getType(),
  ] + $field_definition
    ->getSettings();
}