function theme_coder_review_table_cols in Coder 7.2
Same name and namespace in other branches
- 7 coder_review/coder_review.module \theme_coder_review_table_cols()
Returns HTML for table column elements of coder_review_form().
This function themes the radio buttons and check boxes form elements that might exist in a table column.
Parameters
array $variables: An associative array containing the follwoing keys:
- form: An array with the form definition elements.
1 theme call to theme_coder_review_table_cols()
- _coder_review_settings_form in coder_review/
coder_review.module - Form constructor: Builds settings form API array for coder_review.
File
- coder_review/
coder_review.module, line 974 - Developer module to assist with coder reviews and API upgrade suggestions.
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);
}
}
return theme('table', array(
'rows' => $rows,
'attributes' => array(
'id' => 'filter-order',
),
));
}