ConfigFormBase::buildForm() defines a submit button but does not attach a default submit handler to submit button which causes a problem with configuration forms not being saved if other modules attach their own submit handlers on top of the default ones.

Real world example: If a site has content_translation module enabled, then Account settings configuration form will not be saved because AccountSettingsForm::buildForm() method does not define a submit handler and content_translation_language_configuration_element_process() function, that wants to perform certain content translation actions, is attaching its own submit handler which becomes the only submit handler for the form.

ConfigFormBase::buildForm() should provide a default submit handler for the form so that submitForm() method is always called for configuration forms regardless of other submit handler additions made by other modules, unless specifically removed from the submit handlers list.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

maijs’s picture

Status: Active » Needs review
FileSize
597 bytes

A patch against latest commit 3fb2ec3 is attached.

Status: Needs review » Needs work

The last submitted patch, 1: configformbase-missing-submit-handler-2355053-1.diff, failed testing.

larowlan’s picture

Issue tags: +Needs tests
maijs’s picture

Berdir’s picture

Status: Needs work » Closed (works as designed)

See my comment in the other issue, I think this is by design. This is the default behavior of all forms, if a submit callbacks are added on specific buttons, the global ones are no longer called.

This could be just as confusing the other way round, with this, global submit callbacks would no longer work.