mjordan / persistent_identifiers

Drupal 8/9 Module that provides a generalized framework for minting and persisting persistent identifiers (DOIs, ARKs, etc.).
GNU General Public License v2.0
5 stars 11 forks source link

Minter value not saved #1

Closed mjordan closed 4 years ago

mjordan commented 4 years ago

When I use hook_form_alter() to add an additional submit handler to the config form for this module, the values of the form are not being saved. For example, when I choose "Sample Minter" and save the form:

sample_minter

the option is not saved:

sample_minter_saved

The other form values are not saved either.

I have confirmed that the issue is caused by the custom submit function in the Sample Minter module. When I comment out $form['actions']['submit']['#submit'][] = 'sample_minter_submit'; in the _form_alter() implementation, the form saves as expected.

My goal here is to have only one admin settings form, but to allow any minter and persister module to alter that form to provide their own settings.

mjordan commented 4 years ago

Resolved. Inside the hook_form_alter(), I needed to use $form['#submit'][] = 'sample_minter_submit';, not $form['actions']['submit']['#submit'][] = 'sample_minter_submit';.