I'm new to Drupal and I want to build a simple form. I get this error:
Fatal error: Class Drupal\medical\Form\LoginForm contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (Drupal\Core\Form\FormInterface::submitForm) in C:\xampp\htdocs\Webdevelopment\Burst\Drupal_Test\modules\medical\src\Form\LoginForm.php on line 8
Here's the code:
<?php
namespace Drupal\medical\Form;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Form\FormBase;
class LoginForm extends FormBase {
public function getFormId(){
return 'medical_login';
}
public function buildForm(array $form, FormStateInterface $form_state) {
$form['username'] = array(
'#title' => t('Username'),
'#type' => 'textfield',
'#required' => TRUE,
);
$form['password'] = array(
'#title' => t('Password'),
'#type' => 'password',
'#required' => TRUE,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => 'Login',
);
}
}
What does this error mean exactly and how do I fix this?
Thanks :)