Establish whether a node is NEW in a custom #submit function I need to test whether a user is creating a new node as opposed to editing an existing node in a custom #submit function added to a node edit/creation form.

I can access the node via

$node = $form_state-&gt;getFormObject()-&gt;getEntity();


$node->id() - gives the new node ID so cant be used.

$node->get('nid')  - also gives an gives the new node ID so cant be used.

$node->isNew() - This is actually FALSE in this hook despite it being new content.
You could try this method:

if ($form_state-&gt;getFormObject()-&gt;getOperation() == 'edit') {
  // existing node 
}


These are the operations defined for node:

 "form" = {
   "default" = "Drupal\node\NodeForm",
   "delete" = "Drupal\node\Form\NodeDeleteForm",
   "edit" = "Drupal\node\NodeForm"
 },