Get the form to add a term to a vocabulary programmatically I am working on Drupal 8.9.6.
I am trying to retrieve the form to add a term to a vocabulary programmatically. I know how to do it for a content type:
    $values = array('type' =&gt; $content_type);

    $node = \Drupal::entityTypeManager()
      -&gt;getStorage('node')
      -&gt;create($values);

    $form = \Drupal::entityTypeManager()
      -&gt;getFormObject('node', 'default')
      -&gt;setEntity($node);
    $modal_form =  \Drupal::formBuilder()-&gt;getForm($form);

Nevertheless, I am not able to do the same for the form of adding a term to a vocabulary. Any hint would be more than welcome.
Thanks!
$vocab_machine_name = 'tags';
$values = array('vid' =&gt; $vocab_machine_name);

$term = \Drupal::entityTypeManager()
  -&gt;getStorage('taxonomy_term')
  -&gt;create($values);

$form = \Drupal::entityTypeManager()
  -&gt;getFormObject('taxonomy_term', 'default')
  -&gt;setEntity($term);

$term_form =  \Drupal::formBuilder()-&gt;getForm($form);


Shorter way
$vocab_machine_name = 'tags';

$term = \Drupal\taxonomy\Entity\Term::create([
  'vid' =&gt; $vocab_machine_name,
]);

$term_form = \Drupal::service('entity.form_builder')-&gt;getForm($term, 'default');