What are the variables does one search for when trying to render a custom form? In Drupal 8, the following code renders the node creation form (node/add/page) when integrating it into a custom module:

$node = \Drupal::entityTypeManager()
  -&gt;getStorage('node')
  -&gt;create(['type' =&gt; 'page']);

$form = \Drupal::service('entity.form_builder')-&gt;getForm($node);

print \Drupal::service('renderer')-&gt;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 'node' with 'user' and 'page' with 'user'.

  -&gt;getStorage('user')
  -&gt;create(['type' =&gt; '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?
To answer your explicit question (and to reiterate what Clive said), there's no one thing that you could grep to conclude the arguments to change for the getStorage() &amp; create() methods. 

The above solution assumes:


You're looking for an entity form.
You're aware that EntityFormBuilderInterface::getForm() needs an entity object.
You can build an entity object with Drupal::entityTypeManager(). 


It's a specific solution to building entity forms. If you're looking for a method to find any arbitrary constructed form, this solution isn't going to help here.

The most generic thing one could search for to find such a form (an invoke it for rendering), is probably a label that is unique to the custom form, but it really depends on how the form is constructed (e.g. EntityFormBuilderInterface::getForm(), FormBuilderInterface::getForm(), or some arbitrary form array builder function). 

If you're familiar with the pattern of construction, there might be some specific terms to search for (e.g. searching for classes implementing FormBuilderInterface or EntityFormBuilderInterface), but there's not going to be one search pattern that works for all forms.