article 4
Publié le 03/04/2019I 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(&$vars) { if (in_array( $vars['view']->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!.