You are here

function theme_themekey_table in ThemeKey 6

Function theme_themekey_table().

3 theme calls to theme_themekey_table()
_themekey_paths_form in ./themekey_admin.inc
Function _themekey_paths_form().
_themekey_properties_form in ./themekey_admin.inc
Function _themekey_properties_form().
_themekey_settings_form in ./themekey_admin.inc
Function _themekey_settings_form().

File

./themekey_admin.inc, line 423

Code

function theme_themekey_table($form) {
  $rows = array();
  $header = isset($form['#header']) ? $form['#header'] : array();
  $attributes = isset($form['#attributes']) ? $form['#attributes'] : array();
  $tabledrag = isset($form['#tabledrag']) ? $form['#tabledrag'] : FALSE;
  if ($tabledrag && isset($attributes['id'])) {
    drupal_add_tabledrag($attributes['id'], 'order', 'sibling', $attributes['id'] . '-' . $tabledrag);
  }
  if (isset($attributes['description'])) {
    $rows[] = array(
      array(
        'data' => $attributes['description'],
        'colspan' => count($header),
        'class' => 'message',
      ),
    );
    unset($attributes['description']);
  }
  foreach (element_children($form) as $key) {
    $row = array();
    foreach (element_children($form[$key]) as $item) {
      if ($tabledrag && $tabledrag == $item) {
        $form[$key][$item]['#attributes'] = array(
          'class' => $attributes['id'] . '-' . $tabledrag,
        );
      }
      $row[] = drupal_render($form[$key][$item]);
    }
    $rows[] = $tabledrag ? array(
      'data' => $row,
      'class' => 'draggable',
    ) : $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) : '';
}