You are here

function tablefield_hide_cols in TableField 7.3

Same name and namespace in other branches
  1. 7.2 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 2264
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 = !empty($tabledata) ? count($tabledata) : 0;
  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;
}