I created a module with Drupal 8 beta11 which defines an content entity and a form (contentEntityForm) with custom submit callback.When I tried using the same module with Drupal 8 beta 14 it raise the following error.
Fatal error: Call to a member function
extractFormValues()
on null in C:\xampp\htdocs\drupalbeta14\core\lib\Drupal\Core\Entity\ContentEntityForm.php on line 219
The form code is the following one.
public function buildForm(array $form, FormStateInterface $form_state) {
$form['employee']['first_name'] = array(
'#type' => 'textfield',
'#title' => 'First Name',
'#required' => TRUE,
);
$form['employee']['last_name'] = array(
'#type' => 'textfield',
'#title' => 'Last Name',
'#required' => TRUE,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => 'Submit',
'#name' => 'employee-data',
'#submit' => array('::submitEmployeeData')
);
return $form;
}
public function submitEmployeeData(array $form, FormStateInterface $form_state) {
}
After the form is submitted, the error mentioned above is shown.
I checked the contentEntityForm.php file on beta11 and beta14 and it seems to have a similar definition for extractFormValues()
.