You are here

function theme_hierarchical_select_common_config_form_level_labels in Hierarchical Select 6.3

Same name and namespace in other branches
  1. 5.3 includes/common.inc \theme_hierarchical_select_common_config_form_level_labels()
  2. 7.3 includes/theme.inc \theme_hierarchical_select_common_config_form_level_labels()

File

includes/theme.inc, line 260
All theme functions for the Hierarchical Select module.

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;
}