Compatibility with paragraph behaviors

Created on 26 May 2020, about 4 years ago
Updated 5 March 2024, 4 months ago

Problem/Motivation

Paragraphs have serialized field behavior_settings that needs to be supported. But for unknown to me reason, when trying to pull the entities the data for behavior_settings is not wrapped into 'value' property of array. This causes fatal error in line 130 of core/modules/jsonapi/src/Normalizer/FieldItemNormalizer.php

$property_value_class = $property_definitions[$property_name]->getClass();

because $property_name is not the field property but the name of the paragraphs behavior.

Proposed resolution

Use JSON:API extras module and FieldEnhancer the same way as it is done in entity_share_client module for metatags, block field and pathauto.

Remaining tasks

Review the attached patch

User interface changes

No changes.

API changes

No changes.

Data model changes

No changes.

Release notes snippet

Paragraph Behaviors support with JSON:API extras field enhancer (requires manual configuration).

✨ Feature request
Status

Fixed

Version

3.0

Component

Entity Share Client

Created by

🇩🇪Germany a.dmitriiev

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇮🇳India Abhijith S

    The Serialized Data (Entity Share) field Enhancer is not working in my case .I'm using layout paragraphs → .

    Getting this error while trying to pull layout paragraph pages. The paragraph reference field contents are not being transferred.

  • 🇺🇸United States jeffreysmattson

    I am running into this error now using version: Entity Share Websub '1.1.0' and Entity Share version: '8.x-3.0'. When I don't have a field enhancer set for the field "behavior_settings I get this error:

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

    When I enable the Serialized Data (Entity Share) field enhancer to the field, I get this error:

    Cannot synchronize item 377c680c-3fba-47af-82c9-fe09f12272d0 from channel articles of remote home_site using demo_import.

    When I look at the JSON endpoint that is returning the paragraph, I see that in the "behavior_settings" field is the string "Array".

    This thread looks like it resolved this issue, but I am not sure how to implement the solution as it isn't explained. Is this a new error or am I applying the fix incorrectly?

Production build 0.69.0 2024