Bind with the form mode breaks image uploading with image widget

Created on 1 May 2023, over 1 year ago
Updated 15 February 2024, 9 months ago

Problem/Motivation

When using the "bind with the form mode" option introduced in ✨ Bind paragraph view mode with form mode Fixed on a paragraph type with an image field it is not possible to upload an image due to an AJAX error.

Steps to reproduce

  1. Install and enable paragraph_view_mode 3.1.0 or greater.
  2. Create a new paragraph type.
  3. Add an image field to the paragraph type.
  4. Enable Paragraph view mode field on the paragraph type.
  5. Create a Paragraph field on a content type and configure it to support the paragraph type.
  6. Create a new node of the content type.
  7. Add an instance of the paragraph type.
  8. Attempt to upload an image to the image field.

Form updates with the newly uploaded image.

An AJAX error is logged in the web console and the image widget does not properly update. The site log will have an error: Exception: Serialization of 'Symfony\Component\HttpFoundation\File\UploadedFile' is not allowed in serialize() (line 14 of /app/web/core/lib/Drupal/Component/Serialization/PhpSerialize.php).

Workaround

To work around the issue one can disable the "bind with the form mode" option in the form display settings for each affected Paragraph view mode widget.

Proposed resolution

Unclear but there are a couple of other issues that have addressed a similar error message. Recording here in case they can help troubleshoot this issue:

πŸ› Files cannot be attached to the form Fixed
#2974237: Serialization exception when trying to edit a file/image field β†’
πŸ› Upload files when adding content to group don't work well Fixed

Remaining tasks

Determine how to resolve the issue and create a patch/MR.

πŸ› Bug report
Status

Fixed

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States wells Seattle, WA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024