Call to undefined method: AjaxResponse::create() line 132

Created on 18 September 2023, over 1 year ago
Updated 14 November 2023, over 1 year ago

Problem/Motivation

The dialog is not displayed when editing a file that is attached to a node. It results in:

Error: Call to undefined method Drupal\Core\Ajax\AjaxResponse::create() in Drupal\file_entity\Controller\FileController->inlineEdit() (line 132 of .../file_entity/src/Controller/FileController.php).

Steps to reproduce

Structure -> Content types -> Manage form display (for whatever content type) -> Set the file field widget to use `Editable file`

Edit a node. Under the File attachment Operations, click Edit.

Proposed resolution

Patch src/Controller/FileController.php, replacing two AjaxResponse::create() calls with:

$response = new AjaxResponse();
return $response->addCommand(new OpenDialogCommand($dialog_selector, $title, $form, ['width' => 800]));

and:

$response = new AjaxResponse();
return $response->addCommand(new CloseDialogCommand($dialog_selector));
🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

🇨🇦Canada gregcube

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

Comments & Activities

Production build 0.71.5 2024