You are here

function tablefield_transpose in TableField 7.2

Same name and namespace in other branches
  1. 7.3 tablefield.module \tablefield_transpose()

Helper function to transpose table data arrays.

3 calls to tablefield_transpose()
tablefield_field_formatter_view in ./tablefield.module
Implements hook_field_formatter_view().
tablefield_hide_cols in ./tablefield.module
Hide all empty columns.
tablefield_rtrim_cols in ./tablefield.module
Trim trailing empty columns.

File

./tablefield.module, line 1521
Provides a set of fields that can be used to store tabular data with a node.

Code

function tablefield_transpose($array) {
  $transposed = array();
  foreach ($array as $key => $row) {
    foreach ($row as $subkey => $value) {
      $transposed[$subkey][$key] = $value;
    }
  }
  return $transposed;
}