function theme_hierarchical_select_common_config_form_level_labels in Hierarchical Select 5.3
Same name and namespace in other branches
- 6.3 includes/theme.inc \theme_hierarchical_select_common_config_form_level_labels()
- 7.3 includes/theme.inc \theme_hierarchical_select_common_config_form_level_labels()
Themeing function to render the level_labels settings as a table.
File
- includes/
common.inc, line 361 - Functions used by more than one Hierarchical Select implementation.
Code
function theme_hierarchical_select_common_config_form_level_labels($form) {
// Recover the stored strings.
$strings = $form['#strings'];
$output = '';
$header = array(
t('Level'),
t('Label'),
);
$rows = array();
$output .= drupal_render($form['status']);
$output .= '<div class="level-labels-settings">';
if (isset($form['labels']) && count(element_children($form['labels']))) {
foreach (element_children($form['labels']) as $depth) {
$row = array();
$row[]['data'] = $depth == 0 ? t('Root level') : t('Sublevel !depth', array(
'!depth' => $depth,
));
$row[]['data'] = drupal_render($form['labels'][$depth]);
$rows[] = $row;
}
// Render the table.
$output .= theme('table', $header, $rows, array(
'style' => 'width: auto;',
));
}
else {
// No levels exist yet in the hierarchy!
$output .= '<p><strong>';
$output .= t('There are no levels yet in this !hierarchy!', array(
'!hierarchy' => $strings['hierarchy'],
));
$output .= '</strong></p>';
}
$output .= '</div>';
// Render the remaining form items.
$output .= drupal_render($form);
return $output;
}