function FormTestHooks::formUserRegisterFormAlter

Implements hook_form_FORM_ID_alter() for the registration form.

Attributes

#[Hook('form_user_register_form_alter')]

File

core/modules/system/tests/modules/form_test/src/Hook/FormTestHooks.php, line 60

Class

FormTestHooks
Hook implementations for form_test.

Namespace

Drupal\form_test\Hook

Code

public function formUserRegisterFormAlter(&$form, FormStateInterface $form_state) : void {
  $submit = $this->elementInfoManager
    ->fromRenderable($form)
    ->createChild('test_rebuild', Submit::class);
  $submit->value = $this->t('Rebuild');
  $submit->submit = [
    [
      Callbacks::class,
      'userRegisterFormRebuild',
    ],
  ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.