I am having a hard time using the $op variable when working with forms. It seems that the $op variable is generally part of node_api (which I haven’t really used), but what about the $op variable in a form alter?
How can I make my form alter apply when the node is being edited vs. created?
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: