Re-factor selection of entity type and bundle in config forms

Created on 12 May 2022, over 2 years ago
Updated 12 June 2024, 5 months ago

Problem/Motivation

Many events and conditions provide the option to select an entity type and bundle, or none of them. The drop-down is created at a central place in \Drupal\eca_content\Service\EntityTypes::bundleField and every plugin using that feature, call this method. Now, in #3276448: eca_form: Feature clarification β†’ we introduced such a selection for form events as well, but there we provide the selection as a text field with free entry by the user.

This is inconsistent and needs to be unified. We don't want to provide different widgets for the same purpose.

Proposed resolution

I very much prefer the list approach, where the user does NOT have to type the entity type(s) or bundle name(s), just because of avoiding errors. That currently limits us to single-item-selections only, which is what we currently have all over the eca_content module. There it is resolved by multiple events or multiple conditions, if a user needed multi-items to be selected.

To resolve this restriction, we need a multi select widget in the BPMN.iO module. In ECA we should not work around such UI limitations with user-unfriendly config forms. The form API on Drupal's side could be configured to allow multi-values already and the rest of each plugin could be ready to receive multi value. Then, only on the BPMN.iO input/output do we have to fall back to single values for the time being, until they offer better widgets upstream.

πŸ“Œ Task
Status

Active

Version

2.1

Component

Code

Created by

πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States freelock Seattle

    Hmm not sure whether this should be here or a separate feature request... we're using Easy Email to send various automated mails to users. We've been using views to create a list of recipients, and feeding them into Entity Aware Custom Events, triggering a notification event. This all works great -- however, for each different email template we want to send, we need to create a different custom event which then creates the appropriate email from the easy email template.

    Easy Email uses the core entity system, and each template is a new bundle. We could eliminate a lot of extra custom events if we could pass the bundle in as a token.

    I like the current ability to select a specific entity type and bundle, but if this is being refactored, it seems like having them split into entity type and bundle fields, with an option to allow the bundle to be specified by a token, would be a nice improvement!

  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen

    @freelock this is a good place for your suggestion. In summary, I think the challenge is even more complex. In the case of entity type and bundle, there are these use cases:

    • With a single drop-down, we have only valid list of value combinations. If we break that up into 2 fields, then the seconds needs to change its list of values dynamically, when the first one changes.
    • If we also want to allow tokens, we can't work with drop-downs any longer, unless there is a widget that allows a drop down and optionally a text field?
    • If a plugin supports multiple values, not just a single one, that adds a whole layer of extra difficulty.

    I think, we need to wait until we support Drupal form API, and then we can think about a form widget that maybe supports all these options. But then the beauty will be that other plugins could also benefit from that.

  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen
  • Issue was unassigned.
  • πŸ‡¨πŸ‡­Switzerland boromino
  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen

    This is related to ✨ Add "Use token" option to drop-down lists Active

  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen
Production build 0.71.5 2024