I am adding a custom validation handler to the node edit form, using the following code.
function my_module_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
if ($form_id != 'node_article_edit_form') {
return;
}
// ...
$form['#validate'][] = 'my_module_node_article_edit_form_validate';
}
function my_module_node_article_edit_form_validate(&$form, \Drupal\Core\Form\FormStateInterface $form_state) {
// ...
}
The validation handler is not invoked, though. What is wrong with the code I am using?