Difference between create new and edit node in form alter I have an alter section for a particular content type. In the form alter how can I find out whether it is create new form or edit form?

With dsm($form) in from alter I can get results with several differences between them. What is the best way to distinguish those from each other?

is this a good way?

    if(isset($form['nid']['#value']))
     'means in edit form'
    else 
     'means in create new from'
If you look at the code of node_object_prepare(), which is called from node_form() (the form builder for the node edit/create form), you will see it contains the following code.
  // If this is a new node, fill in the default values.
  if (!isset($node-&gt;nid) || isset($node-&gt;is_new)) {
    foreach (array('status', 'promote', 'sticky') as $key) {
      // Multistep node forms might have filled in something already.
      if (!isset($node-&gt;$key)) {
        $node-&gt;$key = (int) in_array($key, $node_options);
      }
    }
    global $user;
    $node-&gt;uid = $user-&gt;uid;
    $node-&gt;created = REQUEST_TIME;
  }

In an implementation of hook_form_BASE_FORM_ID_alter(), it is enough to use code similar to the following one.
function mymodule_form_node_form_alter(&amp;$form, &amp;$form_state) {
  $node = $form_state['node'];

  if (!isset($node-&gt;nid) || isset($node-&gt;is_new)) {
    // This is a new node.
  }
  else {
    // This is not a new node.
  }
}

If the node is new, then the form is creating a node; if the node is not new, then the form is editing an existing node.
In Drupal 8, every class implementing EntityInterface (including the Node class) override the EntityInterface::isNew() method. Checking if a node is new becomes as easy as calling $node-&gt;isNew(). Since in Drupal 8 there isn't $form_state['node'] anymore, the code becomes the following.
function mymodule_form_node_form_alter(&amp;$form, &amp;$form_state) {
  $node = $form_state-&gt;getFormObject()-&gt;getEntity();

  if ($node-&gt;isNew()) {
    // This is a new node.
  }
  else {
    // This is not a new node.
  }
}