How do I check if the form is an add/edit/delete form? I need to check if the form is for creating, editing, or deleting a node.

Currently, the below snippet allows me to check if the form is for adding or editing a node. How do I check if the form is for deleting a node?

    if (!isset($node-&gt;nid) || isset($node-&gt;is_new)) {
      // The form is for creating a new node. 
    }
    else {
      // The form is for editing the node. 
    }
You could use what said in this answer, with a slight modification.

function example_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  if (strpos(request_path(), '/add') !== FALSE) {
    $page = 'add';
  }
  elseif (strpos(request_path(), '/edit') !== FALSE) {
    $page = 'edit';
  }
  else if (strpos(request_path(), '/delete') !== FALSE) {
    $page = 'edit';
  }
}