From 52e9dcfcb92c55ca7eca51a09da22899772ec3e4 Mon Sep 17 00:00:00 2001
Message-Id: <52e9dcfcb92c55ca7eca51a09da22899772ec3e4.1343480170.git.dmitriy.trt@gmail.com>
From: "Dmitriy.trt" <dmitriy.trt@gmail.com>
Date: Sat, 28 Jul 2012 19:55:41 +0700
Subject: [PATCH] Issue #1309026: don't render empty header

---
 theme/theme.inc |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/theme/theme.inc b/theme/theme.inc
index d424b4e..0b00fb2 100644
--- a/theme/theme.inc
+++ b/theme/theme.inc
@@ -523,6 +523,11 @@ function template_preprocess_views_view_table(&$vars) {
     }
   }
 
+  // Hide table header if all labels are empty.
+  if (!array_filter($vars['header'])) {
+    $vars['header'] = array();
+  }
+
   $count = 0;
   foreach ($vars['rows'] as $num => $row) {
     $vars['row_classes'][$num][] = ($count++ % 2 == 0) ? 'odd' : 'even';
@@ -536,8 +541,11 @@ function template_preprocess_views_view_table(&$vars) {
 
   if (empty($vars['rows']) && !empty($options['empty_table'])) {
     $vars['rows'][0][0] = $view->display_handler->render_area('empty');
-    // Calculate the amounts of rows with output.
-    $vars['field_attributes'][0][0]['colspan'] = count($vars['header']);
+
+    if (!empty($vars['header'])) {
+      // Calculate the amounts of rows with output.
+      $vars['field_attributes'][0][0]['colspan'] = count($vars['header']);
+    }
   }
 
 
-- 
1.7.10.4

