By lauriii on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
10.2.x
Introduced in version:
10.2.0
Issue links:
Description:
It is possible to use \Drupal\Core\Form\SubformState for nested forms that are implementing \Drupal\Core\Form\FormInterface. Previously in this case \Drupal\Core\Form\FormStateInterface::getFormObject always returned the parent form object. Now it is possible to provide \Drupal\Core\Form\SubformState a form object for the subform, enabling <code>\Drupal\Core\Form\FormStateInterface::getFormObject to return the subform object when called for the subform state.
Before:
SubformState::createForSubform($form['subform'], $form, $form_state);
After:
$subform_object = $this->entityTypeManager->getFormObject('user');
SubformState::createForSubform($form['subform'], $form, $form_state, $subform_object);
Impacts:
Module developers