diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 1c46c18d34985566c4dd4c8def5a41ff0125cfb6..9dd8a95cc61673347b9b616b0ab097ca59fde983 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -2,6 +2,7 @@ Zen 6.x-2.x-dev, xxxx-xx-xx (development release) ------------------------ +- Added $build_mode variable to node.tpl.php - #445814: Change primary/secondary link rendering and move secondary menu to footer - #445822: Simplify wrapper divs around logo, site name, slogan - #546862: Add D7's element-hidden and element-invisible for accessibility features diff --git a/template.php b/template.php index 6ae8f5d45ea9f22ddaa6598e35d25a2e312bd442..88668bec9cb5a272d4caa0256baffd0cd020c2cb 100644 --- a/template.php +++ b/template.php @@ -169,7 +169,29 @@ function zen_preprocess_page(&$vars, $hook) { * The name of the template being rendered ("node" in this case.) */ function zen_preprocess_node(&$vars, $hook) { - // Special classes for nodes + // Create the build_mode variable. + switch ($vars['node']->build_mode) { + case NODE_BUILD_NORMAL: + $vars['build_mode'] = $vars['teaser'] ? 'teaser' : 'full'; + break; + case NODE_BUILD_PREVIEW: + $vars['build_mode'] = 'preview'; + break; + case NODE_BUILD_SEARCH_INDEX: + $vars['build_mode'] = 'search_index'; + break; + case NODE_BUILD_SEARCH_RESULT: + $vars['build_mode'] = 'search_result'; + break; + case NODE_BUILD_RSS: + $vars['build_mode'] = 'rss'; + break; + case NODE_BUILD_PRINT: + $vars['build_mode'] = 'print'; + break; + } + + // Special classes for nodes. $classes = array('node'); if ($vars['sticky']) { $classes[] = 'sticky'; diff --git a/templates/node.tpl.php b/templates/node.tpl.php index 13f982f8a106b08a60acfeb6a93cb6f24271622b..cb12dc6a7de8634e1929ecf74e1a01694f941dd4 100644 --- a/templates/node.tpl.php +++ b/templates/node.tpl.php @@ -32,7 +32,8 @@ * - $id: Position of the node. Increments each time it's output. * * Node status variables: - * - $teaser: Flag for the teaser state. + * - $build_mode: Build mode, e.g. 'full', 'teaser'... + * - $teaser: Flag for the teaser state (shortcut for $build_mode == 'teaser'). * - $page: Flag for the full page state. * - $promote: Flag for front page promotion state. * - $sticky: Flags for sticky post setting.