You are here

function theme_delete_all_checkboxes in Delete all 5

Same name and namespace in other branches
  1. 6 delete_all.module \theme_delete_all_checkboxes()
1 theme call to theme_delete_all_checkboxes()
delete_all_content in ./delete_all.module
Original delete_all functions *

File

./delete_all.module, line 253

Code

function theme_delete_all_checkboxes($form) {
  $total = 0;
  foreach ($form as $element_id => $element) {
    if ($element_id[0] != '#') {
      $total++;
    }
  }
  $total = (int) ($total % 3 ? ($total + 2) / 3 : $total / 3);
  $pos = 0;
  $rows = array();
  foreach ($form as $element_id => $element) {
    if ($element_id[0] != '#') {
      $pos++;
      $row = $pos % $total;
      $col = $pos / $total;
      if (!isset($rows[$row])) {
        $rows[$row] = array();
      }
      $rows[$row][$col] = drupal_render($element);
    }
  }
  return theme('table', array(), $rows);
}