Since the release of Drupal 8.6.10 demo content import using the default_content module will fail with an error to the likes of:

The generic FieldItemNormalizer cannot denormalize string values for "settings" properties of the "example_field" field (field item class: Drupal\Core\Field\Plugin\Field\FieldType\StringLongItem).

They had the same issue in the paragraphs module: https://www.drupal.org/project/paragraphs/issues/3034598

I believe it was fixed with a single patch but it's not obvious to me how to fix it in the Formatter Field module.

CommentFileSizeAuthor
#5 formatter-field-3036109-5.patch434 byteschi

Comments

JurriaanRoelofs created an issue. See original summary.

jurriaanroelofs’s picture

Raman Starshykh’s picture

Issue tags: +epam-contrib-2019.03
linichalexey’s picture

Issue tags: -epam-contrib-2019.03
chi’s picture

Status: Active » Needs review
StatusFileSize
new434 bytes

Quick fix.

  • JurriaanRoelofs committed ab256f4 on 8.x-1.x
    Fixes issue #3036109 by Chi, JurriaanRoelofs. Fixes compatability with...
jessehs’s picture

I found that this change caused fatal errors on a site that had existing data. In order to fix the problem, I wrote this custom hook_update_N function inside of a custom module on the platform. I realize that this module should probably be updated with a more extensible solution that would update *all* fields that were created by this module. However, in keeping with the "Quick fix" above, I opted just for a one-off update:

/**
 * Unserialize the field_image_display_settings field after formatter_field update changed schema.
 */
function cms_update_8601() {
  $id_key = 'entity_id';
  $table_name = 'node__field_image_display';
  $field_name = 'field_image_display_settings';

  $database = \Drupal::database();
  // Store the existing values.
  $settings_values = $database->select($table_name)
    ->fields($table_name, [$id_key, $field_name])
    ->execute()
    ->fetchAllKeyed();

  foreach ($settings_values as $id => $value) {
    if ($new_value = unserialize($value)) {
      $database->update($table_name)
        ->fields([$field_name => $new_value])
        ->condition($id_key, $id)
        ->execute();
    }
  }
}

chris matthews’s picture

It looks like the patch in #5 was already committed without being RTBC. Should this issue be closed and a new issue opened (if necessary) to address @jessehs' comment in #7?

jurriaanroelofs’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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