Steps to reproduce:
1. "Article" node has a field referencing "Promo item" nodes, using Inline Entity Form complex widget.
2. Promo item has an image field using Entity Browser widget with the configuration posted below.
3. Create an article with a Promo item. Select files, save the promo item and the node.
4. Edit the article and edit the promo item. Remove the image.
5 Click Select files
Expected result:
Modal opens for uploading or selecting a new file
Actual Result:
Ajax Error:
Uncaught AjaxError:
An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: /node/54/edit?destination=node/54&ajax_form=1&_wrapper_format=drupal_ajax
StatusText: Internal Server Error
ResponseText: {"message":"A fatal error occurred: The specified #ajax callback is empty or not callable."}
Log message:
Symfony\Component\HttpKernel\Exception\HttpException: The specified #ajax callback is empty or not callable. in Drupal\Core\Form\FormAjaxResponseBuilder->buildResponse() (line 74 of /var/www/site/web/core/lib/Drupal/Core/Form/FormAjaxResponseBuilder.php).
Entity Browser widget config:
uuid: f5b48f84-a55c-46b0-9d00-fb6c4f919c97
langcode: und
status: true
dependencies:
enforced:
module:
- file_browser
module:
- dropzonejs_eb_widget
_core:
default_config_hash: 1Qm0yNBmX5LIza8lyQIkB8HlRmBfBBQnSTr1LXS9O1w
name: browse_files
label: 'Browser for files'
display: modal
display_configuration:
widget_ids:
735d146c-a4b2-4327-a057-d109e0905e05: 'Upload files'
a4ad947c-9669-497c-9988-24351955a02f: 'Files listing'
width: '1024'
height: '768'
link_text: 'Select files'
auto_open: false
selection_display: no_display
selection_display_configuration: { }
widget_selector: tabs
widget_selector_configuration: { }
widgets:
a4ad947c-9669-497c-9988-24351955a02f:
settings:
view: files_entity_browser
view_display: entity_browser_1
uuid: a4ad947c-9669-497c-9988-24351955a02f
weight: 1
label: 'Select existing image'
id: view
735d146c-a4b2-4327-a057-d109e0905e05:
settings:
upload_location: 'public://'
dropzone_description: 'Click or drop files here to upload them'
extensions: 'jpg jpeg gif png txt doc xls pdf ppt pps odt ods odp svg'
max_filesize: 2M
uuid: 735d146c-a4b2-4327-a057-d109e0905e05
weight: 0
label: 'Upload image'
id: dropzonejs
Comments
Comment #2
reekris commentedSwitching the browser widget from modal to an iframe fixes the problem.
Comment #3
primsi commentedI've tested this with the latest code and your configuration (which doesn't include an ife wiget). I also added a new ife widget and fixed the configuration-not-saving issue #2366315: Widget configuration is not saved correctly by hand, so that conf was looking like this:
The modal opened normally and files were saving. If you solved the issue otherwise feel free to close the issue.
Comment #4
reekris commented@Primsi thanks for trying to reproduce my issue!
Seems like you might've misunderstood the reproduction steps.
It's not the entity browser config that should have an ief widget it's the reference to the entity containing the image field that is an IEF field.
The bug only occurs when the image field is within an entity referenced via IEF.
Edit:
It also happens when the image field is within a Paragraph using the Paragraphs module. That hints that it is not an IEF issue but en entity browser issue.
Please tel me if you need more info or if anything is unclear.
Comment #5
primsi commentedThanks for the reminder. I glanced over the steps to quickly.
I was able to reproduce it now. The Modal doesn't open after you have removed the EB element. Didn't look into it though.
Comment #6
leksat commentedNot really sure, but maybe #2745091: $is_relevant_submit calculation is not precise is related.
Comment #7
reekris commentedI can still reproduce this issue with the latest dev version of Entity Browser, so the solution in #6 dit not solve the problem unfortunately.
Comment #8
scottsawyerI am also getting this error on 8.x-2.x-dev.
Minimal Setup:
Parent Entity - 1 entity reference field to another content entity, unlimited, form display: ief complex
Child Entity - 1 entity reference field to another content entity, limited 1, form display: entity_browser
Grandchild Entity. - Could be anything, a node or something.
Create a Grandchild. Save.
Create a Parent entity, use ief to create a single Child, use entity_browser to select Grandchild . Save.
Edit Parent. Edit Child. Remove Grandchild. Use entity_browser to select Grandchild. Ajax Error.
This is not happening with the iFrame widget.
Comment #9
scottsawyerWhen I click "Remove", here is what I get back:
Sorry for all of the theme debug cruft. Here is the updated widget cleaned up:
It seems right to me, but it seems the ajax handler is getting confused about something.
Comment #10
scottsawyerIf I edit Parent, create a new Child, add a Grandchild, then remove the Grandchild ( note, I do not save Parent or Child ), here is the ajax response. This successfully opens the modal. As long as I do not save the Parent or Child with a value in the Grandchild field, it works perfectly.
As soon as I save the Child or Parent with a Grandchild field populated, I get the ajax error.
I feel like I saw another issue that was similar to this, only with Paragraphs. That issue was fixed in an earlier version, so I am going to update the Version tag on this issue. I am also not sure this is a User Interface issue, seems more core or something.
Comment #11
scottsawyerI believe this commit has something to do with this problem . I checked out EntityReferenceBrowserWidget.php from the previous commit and suddenly it started working again.
Comment #12
MarkedGoose commentedI can confirm the commit scottsawyer talked about in #11 has something to do with the issue.
Reverting the patch suddenly fixes the issue.
Comment #13
jonathanshawThis may be a duplicate of #2851580: Re-order + remove broken with the Entity Reference (and File) widget, or fixed anyway by fixing that issue; it would be useful is someone could check whether the latest patch from that issue solves this issue.
Comment #14
rikki_iki commentedI think @jonathanshaw is right, the latest patch (#92) from #2851580 fixes this issue for me.
Comment #15
froboyConfirming #2851580: Re-order + remove broken with the Entity Reference (and File) widget worked for me. In my case I had Node > Paragraph > Block (via IEF > Media. Media selection was bringing up a modal and spinning. Applying the linked patch and clearing all browser session data or opening a new session resolved the issue.
Even though the issues are different, I think closing this as a duplicate to redirect folks to the proper issue makes sense.