function theme_tmgmt_ui_translator_review_form in Translation Management Tool 7
Renders a table containing a group of data items belonging to the same field.
1 theme call to theme_tmgmt_ui_translator_review_form()
- _tmgmt_ui_review_form_element in ui/
tmgmt_ui.module - Build form elements for the review form using flatened data items.
File
- ui/
includes/ tmgmt_ui.theme.inc, line 223 - Theme file stub for tmgmt.
Code
function theme_tmgmt_ui_translator_review_form($variables) {
$element = $variables['element'];
$result = '';
$labels = '';
$parent_label = '';
$element_groups = array();
$element_group = '';
foreach (element_children($element) as $key) {
// Label of all element groups.
$parent_label = array_shift($element[$key]['#parent_label']);
$element[$key]['#top_label'] = $parent_label;
$element[$key]['#leave_label'] = array_pop($element[$key]['#parent_label']);
// Start a new element group.
if ($labels != $element[$key]['#parent_label']) {
$labels = $element[$key]['#parent_label'];
if (!empty($labels)) {
// Append to previous group to the group collection.
if (!empty($element_group)) {
$element_groups[] = '<tbody>' . $element_group . '</tbody>';
}
// Header row for the current element group.
$cell = array(
// @todo: Deal with right to left languages.
'data' => check_plain(implode(t(' > '), $labels)),
'colspan' => 4,
);
$element_group = '<tr>' . _theme_table_cell($cell, TRUE) . '</tr>';
}
}
$element_group .= drupal_render($element[$key]);
}
// Append the last group to the group collection.
$element_groups[] = '<tbody>' . $element_group . '</tbody>';
// Display the label of all element groups inside a table header.
if (!empty($parent_label)) {
$cell = array(
'data' => $parent_label,
'colspan' => 5,
);
$result = '<thead><tr>' . _theme_table_cell($cell, TRUE) . '</tr></thead>' . implode('', $element_groups);
}
$table = '<table class="tmgmt-ui-review"><colgroup width="100" /><colgroup width="*" span="2" /><colgroup width="100" />' . $result . '</table>';
return '<div id="' . $element['#ajaxid'] . '">' . $table . '</div>';
}