Impossible to add 2 different confirmation forms to one single entity type

Created on 29 June 2023, over 1 year ago
Updated 30 June 2023, over 1 year ago

Now I could add only one single state-transition-form value for each entity type.
For example, I can't add 2 different confirmation forms to nodes of 2 different bundles.
Right?

💬 Support request
Status

Closed: works as designed

Version

1.0

Component

Code

Created by

🇷🇸Serbia super_romeo Belgrade

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

Comments & Activities

  • Issue created by @super_romeo
  • 🇮🇱Israel jsacksick

    Right, but you can add logic to your form to check the bundle?

  • 🇷🇸Serbia super_romeo Belgrade

    Absolutely.
    But what will happen if 2 independent modules want to define a confirmation form for same entity type?

    For example, in module1.module:

    /**
     * Implements hook_entity_type_alter().
     */
    function module1_entity_type_alter(array &$entity_types) {
        ...
        $type->setLinkTemplate('state-transition-form', '/node/{node}/{field_name}/{transition_id}');
        $type->setFormClass('state-transition-confirm', RequestConfirmForm1::class);
    }
    

    For example, in module2.module:

    /**
     * Implements hook_entity_type_alter().
     */
    function module2_entity_type_alter(array &$entity_types) {
        ...
        $type->setLinkTemplate('state-transition-form', '/node/{node}/{field_name}/{transition_id}');
        $type->setFormClass('state-transition-confirm', RequestConfirmForm2::class);
    }
    

    state-transition-confirm will be overwritten.

  • 🇮🇱Israel jsacksick

    Yes and? There are always solutions to ensure your override comes last? Via a hook_module_implements_alter() for example?

  • Status changed to Closed: works as designed over 1 year ago
  • 🇷🇸Serbia super_romeo Belgrade

    Thank you!

Production build 0.71.5 2024