ECA Form module conflicts with Entity Browser selection in Inline Entity Form

Created on 10 December 2024, about 1 month ago

Hello,

I have a content type Parent with a reference to a content type Child (simple ief, unlimited). Child has a reference to a vocabulary Fruits, unlimited values using entity browser. When trying to create a Child using its node/add form, entity browser works just fine. When trying to create the Child using Parent ief reference field, entity browser doesn't display the selected entity. Saving the Parent works, the child is added to the parrent node.

I noticed that uninstalling ECA Form, Entity Browser works just fine. Please note that I don't have any ECA models.

I'm using php 8.3 with latest Drupal and ECA.

Attached is a small video showing the issue.

Thanks!

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇷🇴Romania gge

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

Merge Requests

Comments & Activities

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

    This sounds like being related to 🐛 ECA Form breaks complex IEF widget Active . Can you provide any more details from the logs please?

  • 🇷🇴Romania gge

    Logs are not present, the console is clean. I'm using the simple ief widget and the same behaviour is present if using the complex widget.

  • 🇩🇪Germany jurgenhaas Gottmadingen

    Logs are not present

    There must be something somewhere. Either in Drupal's watchdog or in the PHP logs. It's hard to watch the video and getting an idea what's going on. If you really can't find any logs anywhere, we then need step by step instructions on how to reproduce this behaviour on a fresh Drupal installation.

  • 🇷🇴Romania gge

    @jurgenhaas I will come back with more information in the next couple of days, thanks.

  • I'm experiencing similar issue with Entity Browser display.

    In my case, I have some custom ECA workflow created for one content type. Custom ECA workflow is utilizing multiple FORM: ADD AJAX HANDLER activities.

    These AJAX handlers were working fine until I upgraded ECA module to version 2.0.9 after which Entity Browsers within the entry/edit page of given content type stopped working - they don't get displayed any more as pop-up window.

    Browser console is giving Ajax (http 500) related error while in Drupal log I'm getting this message :

    LogicException: The database connection is not serializable. This probably means you are serializing an object that has an indirect reference to the database connection. Adjust your code so that is not necessary. Alternatively, look at DependencySerializationTrait as a temporary solution. in Drupal\Core\Database\Connection->__sleep() (line 1920 of C:\xampp\htdocs\project\core\lib\Drupal\Core\Database\Connection.php).

    By downgrading ECA module to version 2.0.8 OR by deleting/removing mentioned FORM: ADD AJAX HANDLER activities from the ECA workflow Entity Browsers appear to work again as expected.

    Hope this info helps for patching the ECA module.

  • 🇩🇪Germany jurgenhaas Gottmadingen

    Thanks @gripphon for the extra details. We don't know for sure if it's caused by the same thing, but it could be.

    I looked through the code changes between 2.0.8 and 2.0.9 and nothing comes to mind what could be causing this.

    So, something that helps us to reproduce the problem on a fresh Drupal installation would be required.

  • 🇩🇪Germany jurgenhaas Gottmadingen

    We still don't have enough details to reproduce this bug. But another issue at 🐛 Add Ajax Handler Cause error in paragraph module Active seems to report something similar. So I had another look into the differences between 2.0.8 and 2.0.9, and I wonder if 📌 Provide more context to ECA action plugins Active could have introduced an issue with serializing plugins.

    To find out, could you try and remove $this->plugin->setEcaAction($this); at line 70 of src/Entity/Objects/EcaAction.php and then check if the error is gone?

    However, please still help us to get a reproducable environment so that we can dig deeper into this.

  • jurgenhaas,

    I just tried to remove $this->plugin->setEcaAction($this); that you suggested and yes, that appear to solve my problem here - Add Ajax Handler Cause error in paragraph module 🐛 Add Ajax Handler Cause error in paragraph module Active

  • 🇩🇪Germany jurgenhaas Gottmadingen

    I've created an MR, please give that a try and let us know if that fixes your issues.

  • Pipeline finished with Success
    8 days ago
    Total: 495s
    #394619
  • Tried MR and got another error below :

    LogicException: The database connection is not serializable. This probably means you are serializing an object that has an indirect reference to the database connection. Adjust your code so that is not necessary. Alternatively, look at DependencySerializationTrait as a temporary solution. in Drupal\Core\Database\Connection->__sleep() (line 1920 of /public_html/core/lib/Drupal/Core/Database/Connection.php).

  • 🇩🇪Germany jurgenhaas Gottmadingen

    So, back to square 1: who can provide us with a step by step guide on how to reproduce this issue on a fresh Drupal 11 site?

  • 🇷🇴Romania gge

    Hello!

    Here are the steps to reproduce this:

    1. Install ECA submodules (I don't have ECA Migrate and ECA Workflow activated)
    2. Install Entity Browser and IEF.
    3. Create taxonomy with couple of terms.
    4. Create the view for entity browser

    5. Create the entity browser.


    6. Create content type Child


    7. Create content type Parent

    8. Try to create Parent content.

    9. Select a term and click the button. After this action you'll notice that the IEF area remains empty.

    Please note there are no ECA models. If the module ECA Form is deactivated, IEF is populated after taxonomy selection.

    Thank you and sorry for the late reply.

  • 🇷🇴Romania gge

    @gripphon: Try NOT to use Build Form event to add the ajax handler. I don't get that error when using Process Form or After build events.

  • 🇩🇪Germany jurgenhaas Gottmadingen

    @gge thanks for the instructions in #14. I wonder if there isn't a way to demonstrate the problem with just core and ECA? Modules like entity browser and IEF are so complex in themselves, that we should first try and reproduce this with plain Drupal.

  • 🇷🇴Romania gge

    My initial issue was the combination of entity browser, ief and eca but in order to get a serialisation error all you have to do is to add an ajax handler to a field after the build form event.

    Attached is a model that adds ajax handler to a reference field. Try to select something from the ajaxified field and the error is logged. This can be reproduced on simplytest.me with nothing else but core and eca.

    If the event is After build form or Process form there's no error.

    Thanks.

  • 🇩🇪Germany jurgenhaas Gottmadingen

    Oh great, now I can reproduce the problem. Thank you so much @gge

    I've now taken a different approach in the MR and it seems to be fixed here. Please give it another try and set to RTBC if successful.

  • Pipeline finished with Success
    6 days ago
    Total: 458s
    #396704
  • Tested new patch and now it works properly.

    Thanks jurgenhaas,

  • 🇮🇳India akulsaxena

    Tested and looks good to me
    Moving it to RTBC+

  • 🇩🇪Germany jurgenhaas Gottmadingen

    Thank you all for testing and feedback, will publish new releases soon.

  • Pipeline finished with Skipped
    5 days ago
    #397517
  • Pipeline finished with Skipped
    5 days ago
    #397518
  • 🇩🇪Germany jurgenhaas Gottmadingen

    Merged and backported to 2.0.x

Production build 0.71.5 2024