WorkflowTransitionElement is called twice on a form

Created on 24 November 2017, about 7 years ago
Updated 26 April 2024, 10 months ago

We use the following pattern in f.e. WorkflowDefaultWidget:

    // Step 1: use the Element.
    $element['#default_value'] = $transition;
    $element += WorkflowTransitionElement::transitionElement($element, $form_state, $form);

    // Step 2: use the Form, in order to get extra/attached fields.
    $entity_form_builder = \Drupal::getContainer()->get('entity.form_builder');
    $workflow_form = $entity_form_builder->getForm($transition, 'add');

Where the last line also calls TransitionElement.

This is not fine, since this bad performance, and the 'default' form_id is Always overridden.

🐛 Bug report
Status

Fixed

Version

1.7

Component

Code

Created by

🇳🇱Netherlands johnv

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.

Production build 0.71.5 2024