Is it possible to have different template files for different display modes of the same entity without using template_preprocess_page()? If not, how can I get all the available display modes for a certain entity type so I can create some sort of automatic template suggestion?

Eg: For a node I have by default the 'Full' and 'Teaser' display types. I can add more display types using Display suite module or by creating a custom module. I need to create multiple template files like node--content-type--teaser.tpl.php to keep everything clean and not use lots of IF statements.

Thanks :)

1 Answer 1


I'll go with this solution after all:

function MYMODULE_preprocess_node(&$vars) {
  $vars['theme_hook_suggestions'][] = 'node__' . $vars['type'] . '__' . $vars['view_mode'];
  • Honestly that's the quickest and I think best way to go. I've been doing that for a bunch of different sites and I can't think of a reason not to do it this way. Commented May 14, 2012 at 16:49
  • 1
    To then override use a name like: node--article--teaser.tpl.php Commented Aug 5, 2013 at 21:18
  • Just to add, I had to flush the cache twice in order to get this Commented Oct 2, 2013 at 13:49
  • Note that the Entity Views Mode module adds this for you.
    – Brian
    Commented Oct 14, 2013 at 20:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.