function theme_matrix_table_form in Matrix field 6
Same name and namespace in other branches
- 5 matrix.module \theme_matrix_table_form()
- 6.2 matrix.module \theme_matrix_table_form()
Theme the matrix elements into a table
1 theme call to theme_matrix_table_form()
- matrix_process in ./
matrix.module - Process the matrix type element before displaying the field.
File
- ./
matrix.module, line 162 - Defines simple matrix field types.
Code
function theme_matrix_table_form($form) {
$rows = array();
$header = $form['header']['#value'];
foreach ($form as $row_key => $fields) {
if (!empty($form['first_col']['#value'][$row_key])) {
$row = array();
$row[] = $form['first_col']['#value'][$row_key];
foreach ($fields as $col_key => $field) {
if ($field['#type'] == 'textfield') {
$row[] = drupal_render($form[$row_key][$col_key]);
}
}
$rows[] = $row;
}
}
drupal_render($form['header']);
drupal_render($form['first_col']);
$output = drupal_render($form);
$output .= '<div id="edit-' . $form['#field_name'] . '-wrapper">';
$output .= '<label>' . $form['#title'] . ': </label>';
$output .= theme('table', $header, $rows, array(
'class' => 'matrix',
));
$output .= '<div class="description">' . $form['#description'] . '</div>';
$output .= '</div>';
return $output;
}