Skip to content
Snippets Groups Projects

Can't import media image if the image field be rename by json_extra

1 file
+ 3
5
Compare changes
  • Side-by-side
  • Inline
@@ -114,15 +114,13 @@ class EntityReference extends ImportProcessorPluginBase implements PluginFormInt
*/
public function processEntity(RuntimeImportContext $runtime_import_context, ContentEntityInterface $processed_entity, array $entity_json_data) {
if (isset($entity_json_data['relationships'])) {
$field_mappings = $runtime_import_context->getFieldMappings();
// Loop on reference fields.
foreach ($entity_json_data['relationships'] as $field_public_name => $field_data) {
$field_internal_name = array_search($field_public_name, $field_mappings[$processed_entity->getEntityTypeId()][$processed_entity->bundle()]);
if (!$processed_entity->hasField($field_internal_name)) {
$this->logger->notice('Error during import. The field @field does not exist.', ['@field' => $field_internal_name]);
if (!$processed_entity->hasField($field_public_name)) {
$this->logger->notice('Error during import. The field @field does not exist.', ['@field' => $field_public_name]);
continue;
}
$field = $processed_entity->get($field_internal_name);
$field = $processed_entity->get($field_public_name);
if ($this->entityReferenceHelper->relationshipHandleable($field) !== EntityReferenceHelperInterface::RELATIONSHIP_HANDLEABLE) {
continue;
Loading