You are here

function theme_themekey_ui_table in ThemeKey 6.4

Same name and namespace in other branches
  1. 6 themekey_ui_admin.inc \theme_themekey_ui_table()
  2. 6.2 themekey_ui_admin.inc \theme_themekey_ui_table()
  3. 6.3 themekey_ui_admin.inc \theme_themekey_ui_table()
  4. 7.3 themekey_ui_admin.inc \theme_themekey_ui_table()
  5. 7 themekey_ui_admin.inc \theme_themekey_ui_table()
  6. 7.2 themekey_ui_admin.inc \theme_themekey_ui_table()

Formats a table with checkboxes used by ThemeKey UI settings form.

Parameters

$form: array() containing form elements to be formatted as table

1 theme call to theme_themekey_ui_table()
themekey_ui_settings_form in ./themekey_ui_admin.inc
ThemeKey UI settings form

File

./themekey_ui_admin.inc, line 236

Code

function theme_themekey_ui_table($form) {
  $header = isset($form['#header']) ? $form['#header'] : array();
  $attributes = isset($form['#attributes']) ? $form['#attributes'] : array();
  $rows = array();
  foreach (element_children($form) as $key) {
    $row = array();
    foreach (element_children($form[$key]) as $item) {
      $row[] = drupal_render($form[$key][$item]);
    }
    $rows[] = $row;
  }
  if (empty($rows)) {
    $message = check_plain(isset($form['#empty']) ? $form['#empty'] : t('There are no items in the table.'));
    $rows[] = array(
      array(
        'data' => $message,
        'colspan' => count($header),
        'align' => 'center',
        'class' => 'message',
      ),
    );
  }
  return count($rows) ? theme('table', $header, $rows, $attributes) : '';
}