Sub form not passed to BlockPlugin's submit callback

Created on 28 February 2018, over 6 years ago
Updated 4 March 2024, 9 months ago

Problem/Motivation

In #2537732: PluginFormInterface must have access to the complete $form_state (introduce SubFormState for embedded forms) β†’ , the SubFormState class was introduced for BlockPlugin's build/validate/submit callbacks, and additionally $form['settings'] (the sub form array) started getting passed to the build/validate callbacks, but not to the submit callback!

That means that $form is different in these two callbacks for everyone writing a BlockPlugin:

($form is $form['settings'] here)
public function blockValidate($form, FormStateInterface $form_state) {

($form is the complete/parent form here)
public function blockSubmit($form, FormStateInterface $form_state) {

Proposed resolution

We should fix this so that the $form argument passed to these callbacks is consistent.

Remaining tasks

Review the patch.

User interface changes

None.

API changes

The sub form is now passed to BlockPlugin's submitForm method, instead of the complete/parent form.

Data model changes

None.

πŸ› Bug report
Status

Needs work

Version

11.0 πŸ”₯

Component
BlockΒ  β†’

Last updated about 19 hours ago

Created by

πŸ‡ΊπŸ‡ΈUnited States samuel.mortenson

Live updates comments and jobs are added and updated live.
  • Needs change record

    A change record needs to be drafted before an issue is committed. Note: Change records used to be called change notifications.

  • Needs release note

    The major change should have a special release note written to summarize the importance of the change. See Write a release note for an issue.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024