function _theme_table_cell

_theme_table_cell($cell, $header = FALSE)

Returns HTML output for a single table cell for theme_table().

Parameters

$cell: Array of cell information, or string to display in cell.

bool $header: TRUE if this cell is a table header cell, FALSE if it is an ordinary table cell. If $cell is an array with element 'header' set to TRUE, that will override the $header parameter.

Return value

HTML for the cell.

File

includes/theme.inc, line 2395
The theme system, which controls the output of Drupal.

Code

function _theme_table_cell($cell, $header = FALSE) {
  $attributes = '';

  if (is_array($cell)) {
    $data = isset($cell['data']) ? $cell['data'] : '';
    // Cell's data property can be a string or a renderable array.
    if (is_array($data)) {
      $data = drupal_render($data);
    }
    $header |= isset($cell['header']);
    unset($cell['data']);
    unset($cell['header']);
    $attributes = drupal_attributes($cell);
  }
  else {
    $data = $cell;
  }

  if ($header) {
    $output = "<th$attributes>$data</th>";
  }
  else {
    $output = "<td$attributes>$data</td>";
  }

  return $output;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!theme.inc/function/_theme_table_cell/7.x