Verify a node with a given node ID exists I created a module that receives the node ID from the form. On form validation, it needs to verify a node with that node ID exists.

How can I verify it?
If you don't want to load the entire node then you can use entity query:

$values = \Drupal::entityQuery('node')-&gt;condition('nid', $id)-&gt;execute();
$node_exists = !empty($values);


This will be much more efficient because it only asks for the ids and not all the node fields.