You are here

public function ProcessedContentLoader::importEntityField in YAML Content 8.2

Process import data into an appropriate field value and assign it.

Parameters

array $field_data: Field data read from the content file for import.

\Drupal\Core\Entity\EntityInterface $entity: The pre-built entity object being populated with field data.

\Drupal\Core\Field\FieldDefinitionInterface $field_definition: The field definition for the field being populated.

Overrides ContentLoaderBase::importEntityField

File

src/ContentLoader/ProcessedContentLoader.php, line 81

Class

ProcessedContentLoader
A ContentLoader supporting processing of content through plugins.

Namespace

Drupal\yaml_content\ContentLoader

Code

public function importEntityField(array $field_data, EntityInterface $entity, FieldDefinitionInterface $field_definition) {

  // Preprocess field data.
  $field_context['entity'] = $entity;
  $field_context['field'] = $field_definition;
  $this
    ->preprocessData($field_data, $field_context);
  parent::importEntityField($field_data, $entity, $field_definition);

  // Postprocess loaded field data.
  $this
    ->postprocessData($field_data, $entity, $field_context);
}