Is there a way to know the view type from PHP code?
The nomenclature for what you're talking about in Views is the display handler. 

If you have the $view object (which you should in virtually all Views scopes), you can find the current object for the display handler at $view-&gt;display_handler. You can find the name by using get_class():

get_class($view-&gt;display_handler);


will return something like

views_plugin_display_page


which is the machine name of the display handler. But in conditionals, you can just use the instanceof type operator:

if ($view-&gt;display_handler instanceof views_plugin_display_page) {
  // ...
}