From e3d4d2c16245a626695e0f7a1b0d25c3e57cf85c Mon Sep 17 00:00:00 2001
From: Tim Steiner <tsteiner2@unl.edu>
Date: Mon, 3 Jun 2013 16:20:59 -0500
Subject: [PATCH] Add a bodyClasses parameter to the WdnTemplates view helper.

---
 library/Unl/View/Helper/WdnTemplate.php | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/library/Unl/View/Helper/WdnTemplate.php b/library/Unl/View/Helper/WdnTemplate.php
index d9a512f..e72ba0c 100644
--- a/library/Unl/View/Helper/WdnTemplate.php
+++ b/library/Unl/View/Helper/WdnTemplate.php
@@ -50,17 +50,21 @@ class Unl_View_Helper_WdnTemplate extends Zend_View_Helper_Abstract
         $this->view->headLink(array('rel' => 'home',
                                     'href' => $staticBaseUrl,
                                     'title' => $layout->siteTitle));
-        
+
+        if (!is_array($layout->bodyClasses)) {
+            $layout->bodyClasses = array();
+        }
+
         require_once 'UNL/Templates.php';
         require_once 'UNL/Templates/CachingService/Null.php';
         UNL_Templates::setCachingService(new UNL_Templates_CachingService_Null());
         UNL_Templates::$options['version'] = UNL_Templates::VERSION3x1;
-        
-        $config = Unl_Application::getOptions();
-        if (isset($config['unl']['templates']['options']) && is_array($config['unl']['templates']['options'])) {
-            UNL_Templates::$options = array_merge(UNL_Templates::$options, $config['unl']['templates']['options']);
-        }
 
+        $config = Unl_Application::getOptions();
+        if (isset($config['unl']['templates']['options']) && is_array($config['unl']['templates']['options'])) {
+            UNL_Templates::$options = array_merge(UNL_Templates::$options, $config['unl']['templates']['options']);
+        }
+        
         if (!$layout->template) {
             if (UNL_Templates::$options['version'] == UNL_Templates::VERSION3x1) {
                 $layout->template = 'Local';
@@ -165,7 +169,11 @@ _gaq.push(['_trackPageview']);
 EOF;
         }
         $template->footercontent .= '</script>' . PHP_EOL;
-        
+
+        foreach ($layout->bodyClasses as $bodyClass) {
+            $template->__params['class']['value'] .= " $bodyClass";
+        }
+
         $html = $template->toHtml();
         return $html;
 	}
-- 
GitLab