Add Ajax Handler Cause error in paragraph module

Created on 3 January 2025, 18 days ago

Problem/Motivation

I set ECA to check for Unique title with Ajax and it works fine until I upgraded from ECA 2.0 to ECA 2.1, I can no longer be able to edit any paragraph inside edit form. Once, I clicked "Edit" to edit an paragraph, an error appear

"Oops, something went wrong. Check your browser's developer console for more details."

Also, in Drupal error log:

LogicException: Settings can not be serialized. This probably means you are serializing an object that has an indirect reference to the Settings object. Adjust your code so that is not necessary. in Drupal\Core\Site\Settings->__sleep() (line 90 of /domains/xxx.com/public_html/core/lib/Drupal/Core/Site/Settings.php).

Steps to reproduce

Build Form -> Form : Add Ajax Handler

in "Form: Add Ajax Handler". Here is what I set

Field name = title
Disable validation errors = no
Validation form fields = title
Target = title[0][value]

If I removed "Sequence Flow" From "Build Form" to "Form: Add Ajax Handler", then, the problem is gone.

Also, try to revert back to ECA 2.0 and keep Sequence Flow From "Build Form" to "Form: Add Ajax Handler", it works fine.

Thanks,

🐛 Bug report
Status

Active

Version

2.1

Component

Code

Created by

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

Comments & Activities

  • Issue created by @abx
  • 🇩🇪Germany jurgenhaas Gottmadingen

    Thanks for reporting this. The only use of Drupal\Core\Site\Settings in ECA is the dynamic event subscriber which is the same in 2.0 and 2.1, which makes me wonder how that error message can be explained.

    We do need more details, though.

    • Do you have a stack trace in the logs when this error happens?
    • How is this related to paragraphs?
    • How did you configure to get unique titles?

    Adding the ajax handler to the title field is one part, but there needs to be something that validates the unique title, and I don't see how that got implemented at you end. We do need that piece to be able to reproduce the issue.

  • 🇩🇪Germany jurgenhaas Gottmadingen

    Also, it sounds like this is similar to 🐛 ECA Form module conflicts with Entity Browser selection in Inline Entity Form Active , can you please have a look? While your report says, there is a difference between the behaviour of ECA 2.0 and 2.1, over there the report sees the difference between 2.0.8 and 2.0.9 - could you please test that with your use case as well?

  • Thanks jurgenhaas,

    You are correct, I just tested and found that this problem appear since 2.0.9.

    - Tested 2.0.8 - No Problem
    - Tested 2.0.9, 2.0.10 and 2.1.0 - Problem

    - How is this related to paragraphs?
    I have multiple paragraphs inside a node. I can't click "edit" or "Collapse". Once I clicked, nothing happen and error appear
    "Oops, something went wrong. Check your browser's developer console for more details."

    - How did you configure to get unique titles?
    I do have "Validate Form" but to test this, I just removed Flow from "Validate Form" to check unique title and the problem still there.

    Here is how to produce this error:
    - Create New Content Type
    - Add a Paragraph field inside newly created content
    - in ECA, Create Build form -> Form: Add Ajax Handler. (Use the value above to check title)

    That's it. When, you click Collapse or add paragraph, error will appear

  • 🇩🇪Germany jurgenhaas Gottmadingen

    So, this is likely a duplicate of the related issue. Therefore, can you try the fix I suggested there yesterday?

  • jurgenhaas,

    I just tried to remove $this->plugin->setEcaAction($this); that you suggested here -> ECA Form module conflicts with Entity Browser selection in Inline Entity Form 🐛 ECA Form module conflicts with Entity Browser selection in Inline Entity Form Active

    and yes, that appear to solve my problem.

    Thank you,

  • 🇩🇪Germany jurgenhaas Gottmadingen

    Thanks @abx for testing and your feedback. I'm closing this issue in favour of the other one, where we continue to fixing that bug.

Production build 0.71.5 2024