You are here

function theme_termcase_overview_vocabularies in Termcase 6

Same name and namespace in other branches
  1. 7 termcase.module \theme_termcase_overview_vocabularies()

Override of the vocabulary overview to display the current termcase settings for each vocabulary.

See also

taxonomy_overview_vocabularies()

1 string reference to 'theme_termcase_overview_vocabularies'
termcase_theme_registry_alter in ./termcase.module
Override the theme_vocabulary_overview_vocabularies function to display the termcase status

File

./termcase.module, line 143
The Termcase module gives you the option to specify specific case-formatting on terms.

Code

function theme_termcase_overview_vocabularies($form) {
  $rows = array();
  foreach (element_children($form) as $key) {
    if (isset($form[$key]['name'])) {
      $vocabulary =& $form[$key];
      $row = array();
      $row[] = drupal_render($vocabulary['name']);
      $row[] = drupal_render($vocabulary['types']);
      switch (_termcase_vocabulary_termcase($vocabulary['#vocabulary']['vid'])) {
        case TERMCASE_UCFIRST:
          $row[] = t('First character uppercase');
          break;
        case TERMCASE_LOWERCASE:
          $row[] = t('All characters lowercase');
          break;
        case TERMCASE_UPPERCASE:
          $row[] = t('All characters uppercase');
          break;
        case TERMCASE_PROPERCASE:
          $row[] = t('All first characters uppercase');
          break;
        default:
          $row[] = t('None');
      }
      if (isset($vocabulary['weight'])) {
        $vocabulary['weight']['#attributes']['class'] = 'vocabulary-weight';
        $row[] = drupal_render($vocabulary['weight']);
      }
      $row[] = drupal_render($vocabulary['edit']);
      $row[] = drupal_render($vocabulary['list']);
      $row[] = drupal_render($vocabulary['add']);
      $rows[] = array(
        'data' => $row,
        'class' => 'draggable',
      );
    }
  }
  if (empty($rows)) {
    $rows[] = array(
      array(
        'data' => t('No vocabularies available.'),
        'colspan' => '5',
      ),
    );
  }
  $header = array(
    t('Name'),
    t('Type'),
    t('Case conversion'),
  );
  if (isset($form['submit'])) {
    $header[] = t('Weight');
    drupal_add_tabledrag('taxonomy', 'order', 'sibling', 'vocabulary-weight');
  }
  $header[] = array(
    'data' => t('Operations'),
    'colspan' => '3',
  );
  return theme('table', $header, $rows, array(
    'id' => 'taxonomy',
  )) . drupal_render($form);
}