function tablefield_hide_cols in TableField 7.2
Same name and namespace in other branches
- 7.3 tablefield.module \tablefield_hide_cols()
Hide all empty columns.
Parameters
array $tabledata: The rationalized tablefield.
bool $ignore_head: Whether ignoring header or not.
1 call to tablefield_hide_cols()
- tablefield_field_formatter_view in ./
tablefield.module - Implements hook_field_formatter_view().
File
- ./
tablefield.module, line 1578 - Provides a set of fields that can be used to store tabular data with a node.
Code
function tablefield_hide_cols($tabledata, $ignore_head = FALSE) {
$row_num = count($tabledata);
if (!$row_num) {
return $tabledata;
}
// Transpose the array.
$tabledata = tablefield_transpose($tabledata);
// Trim trailing empty rows.
$tabledata = tablefield_hide_rows($tabledata, $ignore_head);
// Transpose back.
$tabledata = tablefield_transpose($tabledata);
return $tabledata;
}