Drupal - Get node ID in a form submit
For Drupal 8 Add your custom submit handler in form alter:
$form['actions']['submit']['#submit'][] = '_custom_node_form_submit';
And add custom submit handler:
function _custom_node_form_submit($form, \Drupal\Core\Form\FormStateInterface $form_state) {
echo $form_state->getValue('nid');
}