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?