theme_tableselect

  1. drupal
    1. drupal7
Versionen
drupal7 theme_tableselect($element)

Format a table with radio buttons or checkboxes.

Übergabeparameter

$element An associative array containing the properties and children of the tableselect element. Properties used: header, options, empty, js_select.

Rückgabewert

A themed HTML string representing the table.

Verwandte Themen

Code

includes/form.inc, line 2129

<?php
function theme_tableselect($element) {
  $rows = array();
  if (!empty($element['#options'])) {
    // Generate a table row for each selectable item in #options.
    foreach ($element['#options'] as $key => $value) {
      $row = array();

      // Render the checkbox / radio element.
      $row[] = drupal_render($element[$key]);

      // As theme_table only maps header and row columns by order, create the
      // correct order by iterating over the header fields.
      foreach ($element['#header'] as $fieldname => $title) {
        $row[] = $element['#options'][$key][$fieldname];
      }
      $rows[] = $row;
    }
    // Add an empty header or a "Select all" checkbox to provide room for the
    // checkboxes/radios in the first table column.
    $first_col = $element['#js_select'] ? array(theme('table_select_header_cell')) : array('');
    $header = array_merge($first_col, $element['#header']);
  }
  else {
    // If there are no selectable options, display the empty text over the
    // entire width of the table.
    $header = $element['#header'];
    $rows[] = array(array('data' => $element['#empty'], 'colspan' => count($header)));
  }
  return theme('table', $header, $rows);
}
?>

Kommentare

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen