Entity: Set form display action causes weird dependency issues

Created on 26 July 2025, 8 days ago

Problem/Motivation

The Entity: Set form display action causes a dependency issue through the form view mode settings.

I tried to delete an unused content type, but was unable to do so because the ECA model listed it as a dependency (though in fact it wasn't used by the model).

Steps to reproduce

Simple reproduction on a simple test site with Article and Basic page content types.

1. Create a new form view mode under admin/structure/display-modes/form.
2. Name the form view mode New (or whatever else) and enable it on both Article and Basic page content types. (Eventually change some fields for the New form view mode, although this is not necessary.)
3. Create a simple ECA model with a Prepare form event in the Article contnt type and an add the Entity: Set form display action as a follow-up.

4. Now try to delete the Basic page content type. Drupal would also want to delete the ECA model even if the Basic page that you are attempting to delete was nowhere used in this process.

Proposed resolution

Simply unchecking the New form view mode on the content type to be deleted (here basic page) did not help. I had to remove the action (not just unlink it, but actually remove it) in order to be able to get rid of the dependency.

I'm not familiar with how the dependeny is constructed by ECA, so it might not even be an ECA issue. But I mention it here in case someone faces this dependency problem.

Simple model attached for testing.

🌱 Plan
Status

Active

Version

2.1

Component

Code

Created by

🇮🇪Ireland marksmith

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

Comments & Activities

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

    This is happening in \Drupal\eca_content\Plugin\Action\SetFormDisplay::calculateDependencies and it goes through all EntityFormDisplay entities and those that have the name of the configured display mode ("new" in the sample model) will be added to the dependencies.

    In the sample model that results in this list:

    • core.entity_form_display.node.article.new
    • core.entity_form_display.node.page.new

    I imagine if you go to /admin/structure/display-modes/form you'll find the form display mode there and you can configure it such that it only applies to articles but not page. After that, if you re-save the ECA model, it will re-calculate the dependencies and all should be fine.

  • 🇮🇪Ireland marksmith

    Thanks for the quick response.

    Unfortunately, the suggested solution appears to complicate the matters even further. By going to /admin/structure/display-modes/form and unckecking the New form display mode for Basic page actually deleted the ECA model!

  • 🇩🇪Germany jurgenhaas Gottmadingen

    It's true, dependency management can sometimes be a pain. Maybe you want to try turning dependency management in ECA off? This can be done in the ECA settings. You would have to resave the ECA model afterwards, though.

  • 🇮🇪Ireland marksmith

    All dependency was switched off at the ECA settings page, if that's what you refer to.

    Insofar setting a display mode on a content type inadvertently deletes the ECA model itself, I actually find this a pretty serious issue.

  • 🇩🇪Germany jurgenhaas Gottmadingen

    This is certainly a problem but not an ECA issue. The config entities just have to declare their dependencies, and that's what ECA does. The problem comes from config management and how it handles those dependencies on certain contexts.

Production build 0.71.5 2024