Custom form to modify only some fields of an EntityForm I generated an Entity following this guide. Now I would like to create a custom form to modify only some fields inside a single entity.
I was thinking to create an action inside the controller calling a new/custom form:


I created the routing file to open the form with the specified path (I know I can also create an action inside the controller to open the form with a custom template)
I created the form that extends the main EntityForm:

class DetailedForm extends CompleteEntityForm{
    public function getFormId() {
       return 'detailed_form';
    }

    public function buildForm(array $form, FormStateInterface $form_state){
        $form = parent::buildForm($form, $form_state);
        return $form:
    }
 }

I put some lines of code inside the functions getFormId(), buildForm(), validateForm() and submitForm().


But in the end the result is an error:


  Call to a member function getEntityTypeId() on null in
  \drupal\core\lib\Drupal\Core\Entity\EntityForm.php on line 79 #0
  \drupal\core\lib\Drupal\Core\Form\FormBuilder.php(196):
  Drupal\Core\Entity\EntityForm->getBaseFormId()


Any suggestions?
Based on the comments on the question, I fixed my issue.

I created the routing path to call the controller:

mymodule.manage_detailed:
  path: '/mes-detailed/cp/{eid}'
  defaults:
    _controller: '\Drupal\mymodule\Controller\DetailedController::manageAction'
    _title: 'Detailed'
  requirements:
    _permission: 'access content'


Controller:

class DetailedController extends ControllerBase implements ContainerInjectionInterface {

public function manageAction($eid) { 

    $entityForm = \Drupal::entityTypeManager()
        -&gt;getStorage('main_entity')
        -&gt;load($eid);
    $finalform =  $this-&gt;entityFormBuilder()-&gt;getForm($entityForm);

    $render['form'] = $finalform;

    $render['#theme'] = 'manage_detailed';
    return $render;

}


}


Then I put inside the template all the form with:

{{ form }}


Because using only some fields inside the template didn't allow to save data.
And finally I create the submit function to define the redirect:

public static function manage_form_submit(&amp;$form, &amp;$form_state) {
        $url = \Drupal\Core\Url::fromUri('internal:/link-to-go');
        $form_state-&gt;setRedirectUrl($url);
    }


To call the submit function I used the alter form function inside the module file:

function mymodule_form_alter(&amp;$form, &amp;$form_state, $form_id) {

 //drupal_set_message($form_id); //to show id of the form

 if ($form_id == 'name_of_entity_form'){

    $form['name']['#type'] = 'hidden';
    $form['status']['#type'] = 'hidden';
    $form['new_revision']['#type'] = 'hidden';
    $form['revision_log_message']['#type'] = 'hidden';
    $form['field_n1']['#type'] = 'hidden';
    $form['field_n2']['#type'] = 'hidden';
    $form['field_email_']['#type'] = 'hidden';
    $form['field_nd']['#type'] = 'hidden';
    $form['actions']['delete']['#type'] = 'hidden';

    $form['actions']['submit']['#submit'][] = 'Drupal\mymodule\Controller\DetailedController::manage_form_submit';

  }
}