function theme_coder_review_table_cols in Coder 7
Same name and namespace in other branches
- 7.2 coder_review/coder_review.module \theme_coder_review_table_cols()
Implement theme_cols to theme the radiobuttons and checkboxes form elements in a table column.
1 theme call to theme_coder_review_table_cols()
- _coder_review_settings_form in coder_review/
coder_review.module - Build settings form API array for coder_review.
File
- coder_review/
coder_review.module, line 582
Code
function theme_coder_review_table_cols($variables) {
if (!isset($variables['form']) || !is_array($variables['form'])) {
return '';
}
$form = $variables['form'];
$total = 0;
$cols = isset($form['#cols']) ? $form['#cols'] : 3;
foreach ($form as $element_id => $element) {
if ($element_id[0] != '#') {
$total++;
}
}
$total = (int) ($total % $cols ? ($total + $cols - 1) / $cols : $total / $cols);
$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);
}
}
$output = theme('table', array(
'rows' => $rows,
'attributes' => array(
'id' => 'filter-order',
),
));
return $output;
}