Alter a form based on where it is called from I am using something on the lines of   

  $view = views_get_current_view();
  $build = drupal_get_form("comment_node_contenttype_form", 
  (object) array('nid' =&gt; $view-&gt; args[0])); 
  print render($build);


to print a comment form in my views. 

My challenge is I am using the same code in two different displays. I need to make a few fields in the comment form required only when it is getting called from a particular display.
The following worked for me.

  if ($form_id == 'comment_node_CONTENT_TYPE_form') {
    $view = views_get_current_view();
    if ($view-&gt;current_display == 'block_1') {
      //Alter my form
    }
  }


I checked views_get_current_view function. Since it is using caching there is no harm in calling it again.