Closed (outdated)
Project:
TableField
Version:
7.x-2.0
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
30 Apr 2012 at 10:36 UTC
Updated:
12 Aug 2016 at 06:20 UTC
Jump to comment: Most recent
The module states that leaving the first row of the table blank will stop the table from printing the header. This is untrue and the header is still printed but with blank cells. This is bad markup.
Solution:
At line 198 of tablefield.module change the code from:
// Pull the header for theming
$header = array_shift($tabledata);
// Theme the table for display
$element[$delta]['#markup'] = theme('tablefield_view', array('header' => $header, 'rows' => $tabledata, 'delta' => $delta));to:
// Pull the header for theming
$header = array_shift($tabledata);
if ((!empty ($header['0']['data'])) || (!empty ($header['1']['data']))) {
$element[$delta]['#markup'] = theme('tablefield_view', array('header' => $header, 'rows' => $tabledata, 'delta' => $delta));
} else {
$element[$delta]['#markup'] = theme('tablefield_view', array('header' => NULL, 'rows' => $tabledata, 'delta' => $delta));
}This checks if the first two cells are empty and if so sets the table header to NULL.
Comments
Comment #1
moss.dev commentedNote: I am not the best coder in the world and there could be a better way of doing this. If anyone else has a better solution please chip in.
Thanks
Comment #2
jenlamptonThis is a very old issue, and I cannot reproduce it today. If the problem persists please reopen.