ECA Blocks interfere with one another!?

Created on 30 January 2025, about 1 month ago

Problem/Motivation

As I create multiple blocks using ECA, each of them with its own Conditions, one block keeps interfering with the others, so that the FIRST one to FAIL makes all the others to disappear too!

Steps to reproduce

  1. create new Model, where Event = ECA Block
  2. give it a name
  3. configure your conditions and use an action like RENDER: TEXT to give this block some content
  4. go to /admin/structure/block/list/{themname}, find this block, choose a region for it to show up
  5. find the block's machine name, copy it
  6. in the ECA Model, use action = UNPUBLISH CONTENT BLOCK to make the block disappear when your conditions are not fulfilled; identify the specific block by giving the machine name of the block that you copied earlier
  7. Things work well, so that the content you want to show up ONLY when those conditions are fulfilled DO show up ONLY under those conditions.
  8. get happy and start it all over AGAIN, with NEW conditions and new content,
  9. you end up with 2 or more new blocks, which will try to go through different sets of conditions and, when those are fulfilled, render those multiple blocks with their different contents
  10. PROBLEM: if the THE FIRST ONE returns falls into those "conditions not fulfilled" case, and therefore fall into that
  11. "disappear!"-like Action ("unpublish content block"), that situation will lead to ALL OTHER blocks UNDER that one to FAIL TOO, and disappear, REGARDLESS of some of them having fulfilled their respective conditions

Attached exported files related to the ECA Models PLUS those related to the Blocks created by those Eca Models... is that enought?
Running these tests on a FRESH NEW INSTALLation o Drupal 10.4.1.

🐛 Bug report
Status

Active

Version

2.1

Component

Code

Created by

🇧🇷Brazil marco aurelio rocca

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

Comments & Activities

  • Issue created by @marco aurelio rocca
  • 🇩🇪Germany jurgenhaas Gottmadingen

    The ECA model is incomplete. Did you know that you can export an ECA model from the ECA overview page at /admin/config/workflow/eca? That exports a model as a tar.gz archive and that contains everything required.

  • 🇧🇷Brazil marco aurelio rocca

    Hallo, sorry for forgeting about that. Uploading the exports made through that page. THere's something there called "export as recipe", but I didnt get how it works so I opted for the simple "export" option.

  • 🇩🇪Germany jurgenhaas Gottmadingen

    I don't see how the blocks should be influencing each other, but the models do contain some components that are pretty strange and may cause issues.

    The publish and unpublish block actions should not be used in such a way. Probably they should not be used anywhere at all. They enable or disable a config entity. But doing that in the context of a block render action is completely misplaced. And I don't see why you would even that.

    The "ECA Block" events are there to define blocks that can be placed in the block layout, and you can define the content for each block. But that's it.

    What you're mixing into this is the control whether a block should be visible or not. That's not what's supposed to be happening behind an ECA Block event. To control, whether a block should be visible or not, there are block conditions. And they are currently implemented in the eca_condition module.

  • 🇧🇷Brazil marco aurelio rocca

    Ok, @Jurgenhaas, thank you again for showing my misunderstanding.

    All this is really me trying to reproduce Drupal 7's "RULES LINK" funcionality.

    I opened an issue on ECA CONDITION module, a few days ago, as in https://www.drupal.org/project/eca_condition/issues/3502923 💬 Cannot have MORE THAN ONE block loaded with EcaCondition? Active , hope I can find some help with that too.

  • 🇩🇪Germany jurgenhaas Gottmadingen
Production build 0.71.5 2024