function theme_hierarchical_select_common_config_form_editability in Hierarchical Select 7.3
Same name and namespace in other branches
- 5.3 includes/common.inc \theme_hierarchical_select_common_config_form_editability()
- 6.3 includes/theme.inc \theme_hierarchical_select_common_config_form_editability()
@todo Please document this function.
See also
File
- includes/
theme.inc, line 274 - All theme functions for the Hierarchical Select module.
Code
function theme_hierarchical_select_common_config_form_editability($variables) {
$form = $variables['form'];
// Recover the stored strings.
$strings = $form['#strings'];
$output = '';
$header = array(
t('Level'),
t('Allow'),
t('!item_type', array(
'!item_type' => drupal_ucfirst($strings['item_type']),
)),
);
$rows = array();
$output .= drupal_render($form['status']);
$output .= '<div class="editability-per-level-settings">';
if (isset($form['item_types']) && count(element_children($form['item_types']))) {
foreach (element_children($form['item_types']) as $depth) {
$row = array();
$row[]['data'] = $depth == 0 ? t('Root level') : t('Sublevel !depth', array(
'!depth' => $depth,
));
$row[]['data'] = drupal_render($form['allowed_levels'][$depth]);
$row[]['data'] = drupal_render($form['item_types'][$depth]);
$rows[] = $row;
}
// Render the table and description.
$output .= theme('table', array(
'header' => $header,
'rows' => $rows,
'attributes' => array(
'style' => 'width: auto;',
),
'caption' => '<em>' . t('Per-level settings for creating new !items.', array(
'!items' => $strings['items'],
)),
));
$output .= '<div class="description">';
$output .= t('The %item_type you enter for each level is what will be used in
each level to replace a "<create new item>" option with a
"<create new %item_type>" option, which is often more
intuitive.', array(
'%item_type' => $strings['item_type'],
));
$output .= '</div>';
}
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_children($form);
return $output;
}