From ac64b6f2c4a0b2b57c3fe86f48aaf4f1918e0555 Mon Sep 17 00:00:00 2001
From: Eric Rasmussen <eric@unl.edu>
Date: Thu, 1 Jul 2010 17:00:30 +0000
Subject: [PATCH] use $head_title rather than unl_wdn_head_title(), setting it
 in unl_wdn_preprocess_html()

git-svn-id: file:///tmp/wdn_thm_drupal/branches/drupal-7.x@124 20a16fea-79d4-4915-8869-1ea9d5ebf173
---
 sites/all/themes/unl_wdn/html.tpl.php |  2 +-
 sites/all/themes/unl_wdn/template.php | 24 ++++++++++++++++++++++++
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/sites/all/themes/unl_wdn/html.tpl.php b/sites/all/themes/unl_wdn/html.tpl.php
index 15efb091..1a28e222 100644
--- a/sites/all/themes/unl_wdn/html.tpl.php
+++ b/sites/all/themes/unl_wdn/html.tpl.php
@@ -46,7 +46,7 @@ if (theme_get_setting('use_base')) {
 	$t->head .= '<base href="' . url('<front>', array('absolute' => TRUE)) . '" />' . PHP_EOL;
 }
 
-$t->doctitle = '<title>'. unl_wdn_head_title() .'</title>';
+$t->doctitle = '<title>'.$head_title.'</title>';
 
 $html = $t->toHtml();
 
diff --git a/sites/all/themes/unl_wdn/template.php b/sites/all/themes/unl_wdn/template.php
index 20d70640..3050ac36 100644
--- a/sites/all/themes/unl_wdn/template.php
+++ b/sites/all/themes/unl_wdn/template.php
@@ -1,5 +1,29 @@
 <?php
 
+function unl_wdn_preprocess_html(&$vars, $hook)
+{
+  /**
+   * Change the <title> tag to UNL format: UNL | Department | Section | Page
+   */
+  $head_title[] = 'Home';
+  
+  $trail = menu_get_active_trail();
+  
+  foreach ($trail as $item) {
+    if ($item['type'] & MENU_VISIBLE_IN_BREADCRUMB) {
+      $head_title[] = $item['title'];
+    }
+  }
+  
+  // Change 'Home' to be $site_name
+  array_unshift($head_title, str_replace( 'Home', variable_get('site_name', 'Department'), array_shift($head_title)));
+  
+  //Prepend UNL
+  array_unshift($head_title, 'UNL');
+  
+  $vars['head_title'] = implode(' | ', $head_title);
+}
+
 function unl_wdn_get_instance()
 {
     static $instance;
-- 
GitLab