summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohnAlbin2009-08-14 05:36:48 (GMT)
committer JohnAlbin2009-08-14 05:36:48 (GMT)
commit78362cd3068d30856668c5c1cf53f139087048da (patch)
tree044d7e20daa0ec13350ab7369e6c7b8c31811662
parentae8f07ac8422a6f90d91dfa2df987ddd2d12ade6 (diff)
Added $build_mode variable to node.tpl.php
-rw-r--r--CHANGELOG.txt1
-rw-r--r--template.php24
-rw-r--r--templates/node.tpl.php3
3 files changed, 26 insertions, 2 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 1c46c18..9dd8a95 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 6ae8f5d..88668be 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 13f982f..cb12dc6 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.