Prepare options before prepopulate

Created on 16 January 2024, 8 months ago
Updated 23 July 2024, about 2 months ago

Problem/Motivation

I have custom options element implementation that fetches valid options from an external storage. I used the prepare() method (what else I should have used for this?) to prepopulate the #options element key from the external storage. The webform element works as expected but the prepopulate feature does not work on it because it is not called by \Drupal\webform\WebformSubmissionForm::checkPrepopulateDataValid()

final class RemoteCheckboxes extends Checkboxes {

public function prepare(array &$element, WebformSubmissionInterface $webform_submission = NULL): void {
      $element['#options'] = FetchDataFromExternalSource::call();
}

}

Steps to reproduce

Proposed resolution

Call prepare() on options elements in the above mentioned function.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Needs review

Version

6.2

Component

Code

Created by

πŸ‡­πŸ‡ΊHungary mxr576 Hungary

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024