From c1ae2403fcadddf76e4c050b452bd4dcb4da66db Mon Sep 17 00:00:00 2001
From: Danillo Nunes <git@danillonunes.net>
Date: Wed, 2 May 2012 17:38:53 -0300
Subject: [PATCH] #1549792 by danillonunes: Add support to preprocess.inc and process.inc

---
 alpha/includes/alpha.inc                      |   30 ++++++++++++++++++------
 starterkits/alpha-xhtml/preprocess/README.txt |    7 +++++
 starterkits/alpha-xhtml/process/README.txt    |    7 +++++
 starterkits/omega-html5/preprocess/README.txt |    7 +++++
 starterkits/omega-html5/process/README.txt    |    7 +++++
 starterkits/omega-xhtml/preprocess/README.txt |    7 +++++
 starterkits/omega-xhtml/process/README.txt    |    7 +++++
 7 files changed, 64 insertions(+), 8 deletions(-)

diff --git a/alpha/includes/alpha.inc b/alpha/includes/alpha.inc
index b4be3e2..b355f85 100644
--- a/alpha/includes/alpha.inc
+++ b/alpha/includes/alpha.inc
@@ -92,18 +92,32 @@ function alpha_invoke($type, $hook, &$vars) {
   // If one of the themes in the theme trail implements this hook
   // include the corresponding .inc file and call the associated function.
   foreach (alpha_theme_trail($theme->theme) as $key => $name) {
-    $function = $key . '_alpha_' . $type . '_' . $hook;
-
-    if (!function_exists($function)) {
-      $file = drupal_get_path('theme', $key) . '/' . $type . '/' . $type . '-' . str_replace('_', '-', $hook) . '.inc';
-
-      if (is_file($file)) {
-        include $file;
+    $patterns = array(
+      array(
+        'function' => $key . '_alpha_' . $type,
+        'file_name' => $type
+      ),
+      array(
+        'function' => $key . '_alpha_' . $type . '_' . $hook,
+        'file_name' => $type . '-' . str_replace('_', '-', $hook)
+      )
+    );
+
+    foreach ($patterns as $pattern) {
+      $function = $pattern['function'];
+      $file_name = $pattern['file_name'];
+
+      if (!function_exists($function)) {
+        $file = drupal_get_path('theme', $key) . '/' . $type . '/' . $file_name . '.inc';
+
+        if (is_file($file)) {
+          include $file;
+        }
       }
-    }
 
-    if (function_exists($function)) {
-      $function($vars);
+      if (function_exists($function)) {
+        $function($vars);
+      }
     }
   }
 }
diff --git a/starterkits/alpha-xhtml/preprocess/README.txt b/starterkits/alpha-xhtml/preprocess/README.txt
index ee2fcfa..b701197 100644
--- a/starterkits/alpha-xhtml/preprocess/README.txt
+++ b/starterkits/alpha-xhtml/preprocess/README.txt
@@ -23,6 +23,7 @@ Twitter:        http://twitter.com/Omeglicon
 Any custom preprocess functionality can (rather than directly in template.php) be placed
 in this preprocess folder in a file named as such:
 
+TEMPLATE_preprocess() = preprocess.inc
 TEMPLATE_preprocess_html() = preprocess-html.inc
 TEMPLATE_preprocess_page() = preprocess-page.inc
 TEMPLATE_preprocess_node() = preprocess-node.inc
@@ -37,3 +38,9 @@ wrap the code in a custom hook for Alpha/Omega as such:
 function THEMENAME_alpha_preprocess_HOOK(&$vars) {
   // custom functionality here
 }
+
+or for preprocess.inc file:
+
+function THEMENAME_alpha_preprocess(&$vars) {
+  // custom functionality here
+}
diff --git a/starterkits/alpha-xhtml/process/README.txt b/starterkits/alpha-xhtml/process/README.txt
index 983da3e..ef76301 100644
--- a/starterkits/alpha-xhtml/process/README.txt
+++ b/starterkits/alpha-xhtml/process/README.txt
@@ -23,6 +23,7 @@ Twitter:        http://twitter.com/Omeglicon
 Any custom process functionality can (rather than directly in template.php) be placed
 in this process folder in a file named as such:
 
+TEMPLATE_process() = process.inc
 TEMPLATE_process_html() = process-html.inc
 TEMPLATE_process_page() = process-page.inc
 TEMPLATE_process_node() = process-node.inc
@@ -37,3 +38,9 @@ wrap the code in a custom hook for Alpha/Omega as such:
 function THEMENAME_alpha_process_HOOK(&$vars) {
   // custom functionality here
 }
+
+or for process.inc file:
+
+function THEMENAME_alpha_process(&$vars) {
+  // custom functionality here
+}
diff --git a/starterkits/omega-html5/preprocess/README.txt b/starterkits/omega-html5/preprocess/README.txt
index ee2fcfa..b701197 100644
--- a/starterkits/omega-html5/preprocess/README.txt
+++ b/starterkits/omega-html5/preprocess/README.txt
@@ -23,6 +23,7 @@ Twitter:        http://twitter.com/Omeglicon
 Any custom preprocess functionality can (rather than directly in template.php) be placed
 in this preprocess folder in a file named as such:
 
+TEMPLATE_preprocess() = preprocess.inc
 TEMPLATE_preprocess_html() = preprocess-html.inc
 TEMPLATE_preprocess_page() = preprocess-page.inc
 TEMPLATE_preprocess_node() = preprocess-node.inc
@@ -37,3 +38,9 @@ wrap the code in a custom hook for Alpha/Omega as such:
 function THEMENAME_alpha_preprocess_HOOK(&$vars) {
   // custom functionality here
 }
+
+or for preprocess.inc file:
+
+function THEMENAME_alpha_preprocess(&$vars) {
+  // custom functionality here
+}
diff --git a/starterkits/omega-html5/process/README.txt b/starterkits/omega-html5/process/README.txt
index 983da3e..ef76301 100644
--- a/starterkits/omega-html5/process/README.txt
+++ b/starterkits/omega-html5/process/README.txt
@@ -23,6 +23,7 @@ Twitter:        http://twitter.com/Omeglicon
 Any custom process functionality can (rather than directly in template.php) be placed
 in this process folder in a file named as such:
 
+TEMPLATE_process() = process.inc
 TEMPLATE_process_html() = process-html.inc
 TEMPLATE_process_page() = process-page.inc
 TEMPLATE_process_node() = process-node.inc
@@ -37,3 +38,9 @@ wrap the code in a custom hook for Alpha/Omega as such:
 function THEMENAME_alpha_process_HOOK(&$vars) {
   // custom functionality here
 }
+
+or for process.inc file:
+
+function THEMENAME_alpha_process(&$vars) {
+  // custom functionality here
+}
diff --git a/starterkits/omega-xhtml/preprocess/README.txt b/starterkits/omega-xhtml/preprocess/README.txt
index ee2fcfa..b701197 100644
--- a/starterkits/omega-xhtml/preprocess/README.txt
+++ b/starterkits/omega-xhtml/preprocess/README.txt
@@ -23,6 +23,7 @@ Twitter:        http://twitter.com/Omeglicon
 Any custom preprocess functionality can (rather than directly in template.php) be placed
 in this preprocess folder in a file named as such:
 
+TEMPLATE_preprocess() = preprocess.inc
 TEMPLATE_preprocess_html() = preprocess-html.inc
 TEMPLATE_preprocess_page() = preprocess-page.inc
 TEMPLATE_preprocess_node() = preprocess-node.inc
@@ -37,3 +38,9 @@ wrap the code in a custom hook for Alpha/Omega as such:
 function THEMENAME_alpha_preprocess_HOOK(&$vars) {
   // custom functionality here
 }
+
+or for preprocess.inc file:
+
+function THEMENAME_alpha_preprocess(&$vars) {
+  // custom functionality here
+}
diff --git a/starterkits/omega-xhtml/process/README.txt b/starterkits/omega-xhtml/process/README.txt
index 983da3e..ef76301 100644
--- a/starterkits/omega-xhtml/process/README.txt
+++ b/starterkits/omega-xhtml/process/README.txt
@@ -23,6 +23,7 @@ Twitter:        http://twitter.com/Omeglicon
 Any custom process functionality can (rather than directly in template.php) be placed
 in this process folder in a file named as such:
 
+TEMPLATE_process() = process.inc
 TEMPLATE_process_html() = process-html.inc
 TEMPLATE_process_page() = process-page.inc
 TEMPLATE_process_node() = process-node.inc
@@ -37,3 +38,9 @@ wrap the code in a custom hook for Alpha/Omega as such:
 function THEMENAME_alpha_process_HOOK(&$vars) {
   // custom functionality here
 }
+
+or for process.inc file:
+
+function THEMENAME_alpha_process(&$vars) {
+  // custom functionality here
+}
-- 
1.7.3.2

