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