You are here

function tablefield_rtrim_cols in TableField 7.2

Same name and namespace in other branches
  1. 7.3 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 1499
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 = count($tabledata);
  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;
}