In Drupal 8, the following code renders the node creation form (node/add/page) when integrating it into a custom module:
$node = \Drupal::entityTypeManager() ->getStorage('node') ->create(['type' => 'page']); $form = \Drupal::service('entity.form_builder')->getForm($node); print \Drupal::service('renderer')->render($form);
We know the module in question is the Node module, which generates the content type page. What should I do to render the user creation form (/admin/people/create)?
I can easily change the code to the following, and replace
->getStorage('user') ->create(['type' => 'user']);
This would now render the user creation form. For me to come to the conclusion that it would render the user form was only a guess and apparently it works. But this problem solving approach will not work if I wanted to render some other form that might not be so obvious.
What does one have to grep for in the code base or other investigative work to come to the conclusion of the following 2 lines in the above code?