Custom submit handler never gets called I want to check a data when an user submits a form. I set a custom submit handler in form alter, but my custom handler function never gets called. I don't understand why. 

This is my code :

/**
 * Implements hook_form_alter().
 */
function custommodule_form_alter(&amp;$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id)
{
    if($form_id == "node_test_form") {
        kint("toto"); //toto is displayed when I load the form page
        $form_state-&gt;setSubmitHandlers(array("_custommodule_test"));
    }
}

function _custommodule_test(&amp;$form, \Drupal\Core\Form\FormStateInterface $form_state){
    kint("mwahahaa?"); // never displayed
    die(); // doesn't work, the submit form page loaded successfully
}


I cleared cache, but the issue is still there.

Edit ##

I tested add a validate handler, the problem persists.. The code : 

/**
 * Implements hook_form_alter().
 */
function custommodule_form_alter(&amp;$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id)
{
    if($form_id == "node_test_form") {
        kint("toto"); //toto is displayed when I load the form page
        $form_state-&gt;setSubmitHandlers(array("custommodule_myform_mysubmit"));
        $form_state-&gt;setValidateHandlers(array("custommodule_myform_myvalidate"));
        $form_state-&gt;getSubmitHandlers(); // display array("custommodule_myform_mysubmit")
        $form_state-&gt;getValidateHandlers(); // display array("custommodule_myform_myvalidate")
    }
}

function custommodule_myform_mysubmit(&amp;$form, \Drupal\Core\Form\FormStateInterface $form_state){
    kint("submit ?"); // never displayed
    die(); // doesn't work, the submit form page loaded successfully
}

function ccustommodule_myform_myvalidate(&amp;$form, \Drupal\Core\Form\FormStateInterface $form_state){
    kint("Validate ?"); // never displayed
    die(); // doesn't work, the submit form page loaded successfully
}
validate and submit handlers are added to the corresponding form element, e.g. $form['actions']['submit']['#submit'][] = 'foo'.  and same for #validate.

Honestly no idea what those methods are used for, never used them. Maybe internally, during form processing.

Also note that the node form currently has multiple submit buttons (save as published, unpublished and so on), so you'd probably need to add your submit to all of those.