public function ContentLoaderBase::importFieldItem in YAML Content 8.2
Process import data for an individual field list item value.
Parameters
array|string $field_item_data: Field data for the individual field item as 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.
Return value
mixed The processed field item value for storage in the field.
2 calls to ContentLoaderBase::importFieldItem()
- ContentLoaderBase::importEntityField in src/
ContentLoader/ ContentLoaderBase.php - Process import data into an appropriate field value and assign it.
- ProcessedContentLoader::importFieldItem in src/
ContentLoader/ ProcessedContentLoader.php - Process import data for an individual field list item value.
1 method overrides ContentLoaderBase::importFieldItem()
- ProcessedContentLoader::importFieldItem in src/
ContentLoader/ ProcessedContentLoader.php - Process import data for an individual field list item value.
File
- src/
ContentLoader/ ContentLoaderBase.php, line 257
Class
- ContentLoaderBase
- A base ContentLoader implementation to be extended by new content loaders.
Namespace
Drupal\yaml_content\ContentLoaderCode
public function importFieldItem($field_item_data, EntityInterface $entity, FieldDefinitionInterface $field_definition) {
// Is it an entity reference?
if (is_array($field_item_data) && isset($field_item_data['entity'])) {
$item_value = $this
->importEntity($field_item_data);
}
else {
$item_value = $field_item_data;
}
return $item_value;
}