Issue #2747273 by quietone, mayurjadhav, talhaparacha: Example given on FormBuilder::submitForm API Page is not working

merge-requests/2392/head
Alex Pott 2022-06-17 00:43:25 +01:00
parent 08322e887e
commit d06b0a8f29
No known key found for this signature in database
GPG Key ID: BDA67E7EE836E5CE
1 changed files with 3 additions and 7 deletions

View File

@ -138,15 +138,11 @@ interface FormBuilderInterface {
*
* For example:
* @code
* // register a new user
* // Set the administrator role to 'content_editor'.
* $values['user_admin_role'] = 'content_editor';
* $form_state = new FormState();
* $values['name'] = 'some-user';
* $values['mail'] = 'someuser@example.com';
* $values['pass']['pass1'] = 'password';
* $values['pass']['pass2'] = 'password';
* $values['op'] = t('Create new account');
* $form_state->setValues($values);
* \Drupal::formBuilder()->submitForm('user_register_form', $form_state);
* \Drupal::formBuilder()->submitForm(RoleSettingsForm::class, $form_state);
* @endcode
*
* @param \Drupal\Core\Form\FormInterface|string $form_arg