Problem/Motivation
The generator template src/Drush/Generators/extra-field-form.twig adds its element to $form['example_field'] by reference and returns nothing. ExtraFieldFormManager::entityFormAlter() assigns the return value ($form[$fieldName] = $plugin->formElement(...)), so the extra field ends up NULL and the element ignores the form display's weight and visibility. Related: #3358508: Compatibility with field group.
Proposed resolution
Build the element in a local variable and return it, as the example plugins do. Coordinate with #3363600: Add support for Drupal Code Generator version 3 (required for drush 12), which rewrites this template and adds a : void return type.
Issue fork extra_field-3636372
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
pcambraComment #5
pcambra