Get display name from hook_preprocess_views_view I want to use hook_preprocess_views_view in order for several views to share the same template, by adding theme_hook_suggestions as described in this article: http://greenash.net.au/thoughts/2014/04/sharing-templates-between-multiple-drupal-views/

function mytheme_preprocess_views_view(&amp;$vars) {

  if (in_array(
    $vars['view']-&gt;name, array(
      'whatever'))) {
    $vars['theme_hook_suggestions'][] =
      'whatever';
  }
}


Problem is, I need to specify which display of the particular view it should apply to, rather than the whole view itself. I've tried printing the $vars out which results in a huge recurring array which doesn't seem to include the display name anywhere.

I'm also aware you do this via tagging in the views UI. The same problem occurs though - I can't add a tag to a particular display of a view.

If there is another way I can accomplish this I'm all ears!
You can get the display ID through the current_display property of the View object, e.g.

$view = $vars['view'];
if ($view-&gt;name == 'foo' &amp;&amp; $view-&gt;current_display == 'bar') {
  // ...
}