From 45b0ca6773d776f03aff197be968ceb9dd6bfc29 Mon Sep 17 00:00:00 2001
From: barrett <barrett@52745.no-reply.drupal.org>
Date: Tue, 3 Apr 2012 19:20:47 -0400
Subject: [PATCH] updating based on Coder upgrade guidance and verifying
 'head' and 'styles' exist in the preprocess function before
 appending to them

---
 usasearch.info   |    7 ++++---
 usasearch.module |    3 +++
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/usasearch.info b/usasearch.info
index 2f6a639..d6d72d8 100644
--- a/usasearch.info
+++ b/usasearch.info
@@ -1,7 +1,8 @@
 name = USASearch
 description = "Provides customized search using the General Services Administration's USASearch program"
-core = 6.x
-dependencies[] = search
-dependencies[] = jquery_update
+core = 7.x
 configure = admin/settings/usasearch
 package = USASearch
+
+dependencies[] = search
+dependencies[] = jquery_update
diff --git a/usasearch.module b/usasearch.module
index a577ec0..602580e 100644
--- a/usasearch.module
+++ b/usasearch.module
@@ -73,9 +73,12 @@ function usasearch_preprocess_page(&$variables) {
     // Add external scripts into $variables['head'], instead of $variables['scripts'], due to jquery_update module, any 6-2x version as of 12/29/2011, clobbering $variables['scripts'].
     // This also means we need to defer the script loading so that they see the jquery javascript since these lines will print before the jquery script include.
     // See jquery_update module issue http://drupal.org/node/965680 for more information and to check the status of this problem.
+    
+    $variables['head'] = array_key_exists('head', $variables) ? $variables['head'] : '';
     $variables['head'] .= '<script type="text/javascript" defer="defer" src="http://search.usa.gov/javascripts/jquery/jquery.autocomplete.min.js"></script>' . "\n";
     $variables['head'] .= '<script type="text/javascript" defer="defer" src="http://search.usa.gov/javascripts/sayt.js"></script>' . "\n";
     // Add external css.
+    $variables['styles'] = array_key_exists('styles', $variables) ? $variables['styles'] : '';
     $variables['styles'] .= '<link type="text/css" rel="stylesheet" media="all" href="http://search.usa.gov/stylesheets/compiled/sayt.css" />' . "\n";
 
     // Check for usasearch_affiliate_id variable, if set output javascript inline WITH affilite id to limit suggestions.
-- 
1.7.4.4

