I have a Views page and I want to insert the user creation form as found in /admin/people/create into the Views page header. I know people frown upon the PHP filter, but I just need to output the user registration form, which is at most 2 lines of php code vs having to make a module just for that. Unless there is a better way?
I know drupal_get_form()
has been replaced from the form builder in Drupal 8, and the Drupal 8 equivalent of drupal_get_form()
is, for example, $form = \Drupal::formBuilder()->getForm(Drupal\user\Form\UserLoginForm::class);
.
But how do I get the form name or ID? How do I put it in that example? Do I just inspect the form and grab the form ID?
I tried the following code, but I nothing gets returned. What could I be missing?
$form = \Drupal::formBuilder()->getForm(Drupal\user\Form\user_register_form::class);
drupal_render($form);