You are here

public function crumbs_UI_TableSection::getDrupalRows in Crumbs, the Breadcrumbs suite 7.2

Returns rows that can be used in Drupal 7's theme('table').

Return value

array[] Format: $[]['data'][]['data'] = $cellHtml $[]['data'][]['header'] = true|false $[]['data'][][$cellAttributeName] = $cellAttributeValue $[][$rowAttributeName] = $rowAttributeValue

File

lib/UI/TableSection.php, line 129

Class

crumbs_UI_TableSection

Code

public function getDrupalRows() {
  $drupalRows = array();
  foreach ($this
    ->getMatrix() as $rowName => $rowCells) {
    $drupalCells = array();
    foreach ($rowCells as $colName => $cell) {
      list($cellHtml, $tagName, $attributes) = $cell;
      $drupalCell = array();
      $drupalCell['data'] = $cellHtml;
      if ('th' === $tagName) {
        $drupalCell['header'] = TRUE;
      }
      if (!empty($attributes)) {
        $drupalCell += $attributes;
      }
      $drupalCells[] = $drupalCell;
    }
    $drupalRow = array();
    $drupalRow['data'] = $drupalCells;
    if (!empty($this->rowAttributes[$rowName])) {
      $drupalRow += $this->rowAttributes[$rowName];
    }
    $drupalRows[] = $drupalRow;
  }
  return $drupalRows;
}