You are here

function crumbs_UI_TableSection::render in Crumbs, the Breadcrumbs suite 7.2

Renders the table section as a tbody, thead or tfoot.

Parameters

string $sectionTagName: Either 'thead' or 'tbody' or 'tfoot'.

Return value

string Rendered table html.

File

lib/UI/TableSection.php, line 97

Class

crumbs_UI_TableSection

Code

function render($sectionTagName) {
  $html = '';
  foreach ($this
    ->getMatrix() as $rowName => $rowCells) {
    $rowHtml = '';
    foreach ($rowCells as $colName => $cell) {
      list($cellHtml, $tagName, $attributes) = $cell;
      $attributes = !empty($attributes) ? drupal_attributes($attributes) : '';
      $rowHtml .= '<' . $tagName . $attributes . '>' . $cellHtml . '</' . $tagName . '>';
    }
    $rowAttributes = isset($this->rowAttributes[$rowName]) ? drupal_attributes($this->rowAttributes[$rowName]) : '';
    $html .= '<tr' . $rowAttributes . '>' . $rowHtml . '</tr>';
  }
  if ('' === $html) {
    return '';
  }
  return '<' . $sectionTagName . '>' . $html . '</' . $sectionTagName . '>';
}