When I click the “Add Filter” button, I need to open a modal with a select input element. Then I need to send the user’s choice back to the Drupal Form instance and extend the original form, based on the user’s input.
I’m not sure of the best way to do this. 2 options I’ve thought of are:
-
Is it possible to have the “Add Filter” ajax callback send an “OpenModalDialogCommand” with a new form, then have the new form “submitForm” method send the data to the original form?
-
Another possibility would be to collect the data clientside and send it to the original form.
However I’m not sure how to get the user data into the original form in either of the options above.