We have custom entity type X, which has a definition in src/Entity/X.php

public static function baseFieldDefinitions(EntityTypeInterface $entity_type): array {
  $fields['title']
    ->setSettings([
      'text_processing' => 0,
    ])
    ->setTranslatable(TRUE);

In our node type, we have entity reference to these X.

The export exports 'title' like this:

field_x:
    -
      uuid: 4ecb6039-3fd7-4040-8bc3-0be4d3d765bb
      entity_type: x
      bundle: bundle_x
      base_fields:
        title: 'The title of the X'

When importing this, the importer fails in importFieldValue, because it expects the 'title' to be an array value, not a string.

It seems the code it tries to treat entity 'property' (base field) as a UI field, which always has value as an array.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

jvdkolk created an issue. See original summary.

nginex made their first commit to this issue’s fork.

nginex’s picture

Version: 2.0.x-dev » 1.4.x-dev

nginex changed the visibility of the branch 3562380-deal-with-string-fields to hidden.

nginex’s picture

Status: Active » Needs review
jvdkolk’s picture

Status: Needs review » Reviewed & tested by the community

Works!

nginex’s picture

Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • nginex committed d5698086 on 1.4.x
    Issue #3562380: Convert non-array values to array during import
    

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.