Allow nested email field to be selectable in handler settings

Created on 6 February 2025, 23 days ago

Problem/Motivation

The submission handler form for this module requires an "Email field" to be selected. The options for that select box should list all email fields within the webform. However, it only looks for email fields at the top level of the form hierarchy, not anything nested within a container or flexbox layout. This makes it difficult to provide more complex layouts and groupings of fields.

Steps to reproduce

Within your webform, add any container element (fieldset, details, etc) or Flexbox layout. Then drag your email field within this element.

This field is no longer an option within the MyEmma submission handler's "Email field" select box. And if this is your only email field, then the submission handler cannot be submitted because the select field is required.

Proposed resolution

Within WebformMyEmmaHandler.php β†’ buildConfigurationForm(), change

$fields = $this->getWebform()->getElementsDecoded();
to
$fields = $this->webform->getElementsInitializedFlattenedAndHasValue();

As seen in the next code block, this will flatten the hierarchy to find all email fields. Probably code some optimizations so it does not duplicate the $elements variable too.

Remaining tasks

Create merge request/patch.
Test change to ensure the correct field is still submitted.

User interface changes

None

API changes

None

Data model changes

None

πŸ› Bug report
Status

Active

Version

1.1

Component

User interface

Created by

πŸ‡ΊπŸ‡ΈUnited States noahterp

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

Comments & Activities

Production build 0.71.5 2024