Error saving contents with media reference field

Created on 13 July 2023, over 1 year ago
Updated 11 September 2023, over 1 year ago

Problem/Motivation

When a user create a new content (where you have to add a media reference using media library) and save the content, the content is created but a page with the ajax command return value is displayed 'command' => 'closeSidePanel',

Steps to reproduce

Configure frontend_editing to be used with nodes
Create a node that have an image reference field that it is configure to use media library to select the image (that use ajax)
Once the image and mandatory fields are filled save the content
The content will be created but a page with 'command' => 'closeSidePanel', will be displayed

Proposed resolution

I'm not sure but after debug it a bit I found frontend_editing_success is added to submit actions when the modal to search and select images is opened. I think that could be the issue because we are not really using frontend_editing when we are in node/add/xxx.
could it be the condition in frontend_editting_form_alter should be more specific?

if (!empty($input['_drupal_ajax'])) {
      $form['actions']['submit']['#submit'][] = 'frontend_editing_success';
    }
🐛 Bug report
Status

Fixed

Version

1.1

Component

Code

Created by

🇪🇸Spain fran seva

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

Comments & Activities

Production build 0.71.5 2024