There is no $op variable in hook_form_alter()
. The standard way to discern a node edit from a create form is to look if the node already has a nid (node id). If it has one, you know it is an already existing one, otherwise it is still in the process of being created:
function yourModule_form_alter(&$form, &$form_state, $form_id) {
// Is this a node edit/create form at all?
if (isset($form['type']) && isset($form['#node']) && $form['type']['#value'] .'_node_form' == $form_id) {
// Yes, is the node an already existing one?
if (isset($form['#node']->nid)) {
// Yes, existing node, add manipulation for node edit form
}
else {
// No, new node, add manipulation for node create form
}
}
}