You are here

public function DynamicEntityReferenceItem::getValue in Dynamic Entity Reference 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/Field/FieldType/DynamicEntityReferenceItem.php \Drupal\dynamic_entity_reference\Plugin\Field\FieldType\DynamicEntityReferenceItem::getValue()

Gets the data value.

Return value

mixed The data value.

Overrides EntityReferenceItem::getValue

File

src/Plugin/Field/FieldType/DynamicEntityReferenceItem.php, line 469

Class

DynamicEntityReferenceItem
Defines the 'dynamic_entity_reference' entity field type.

Namespace

Drupal\dynamic_entity_reference\Plugin\Field\FieldType

Code

public function getValue() {
  $values = parent::getValue();
  if (!empty($values['target_type'])) {
    $this
      ->get('entity')
      ->getTargetDefinition()
      ->setEntityTypeId($values['target_type']);
  }
  return $values;
}