You are here

function crumbs_Admin_WeightsTable::getRows in Crumbs, the Breadcrumbs suite 7.2

Return value

array

File

lib/Admin/WeightsTable.php, line 38

Class

crumbs_Admin_WeightsTable
This class is a helper for theme_crumbs_weights_tabledrag()

Code

function getRows() {
  array_multisort($this->sortEnabled, $this->sections['enabled']);
  list($grid, $n_grid_columns) = $this
    ->gridOfDescriptions();
  $n = 4 + $n_grid_columns;
  $rows = array();
  foreach ($this->sections as $section_key => $section_rows) {
    foreach ($section_rows as $row_key => &$row) {
      $cells =& $row['data'];
      if (4 === count($cells)) {

        // Regular row
        if (isset($grid[$row_key])) {
          $cells = array_merge($cells, $grid[$row_key]);
        }
        else {
          $cells[] = array(
            'data' => '',
            'colspan' => $n_grid_columns,
          );
        }
      }
      elseif (1 === count($cells)) {

        // Section header row
        $cells[0]['colspan'] = $n;
      }
    }
    $rows = array_merge($rows, array_values($section_rows));
  }
  return $rows;
}