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.

Command icon 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

pcambra created an issue. See original summary.

pcambra’s picture

Status: Active » Needs review

  • pcambra committed 91dd4512 on 3.0.x
    Issue #3636372: Generated extra field form plugin does not return the...
pcambra’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.