Hello all,

Though I suppose separate tpl's per view mode would be the better approach, how do I check for a new view mode within a single template file?

Obviously, checking for the $teaser variable does not suffice.

Thank you in advance

Comments

dave reid’s picture

Status: Active » Fixed

According to template_preprocess_node and the documentation in node.tpl.php, you should have access to a $view_mode variable already.

 * Node status variables:
 * - $view_mode: View mode; for example, "full", "teaser".
 * - $teaser: Flag for the teaser state (shortcut for $view_mode == 'teaser').

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.