You are here

function theme_termcase_overview_vocabularies in Termcase 7

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

Override the vocabulary admin overview.

We want to display the current termcase settings for each vocabulary.

1 string reference to 'theme_termcase_overview_vocabularies'
termcase_theme_registry_alter in ./termcase.module
Override of theme_vocabulary_overview_vocabularies().

File

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

Code

function theme_termcase_overview_vocabularies($variables) {
  $form = $variables['form'];
  $rows = array();
  foreach (element_children($form) as $key) {
    if (isset($form[$key]['name'])) {
      $vocabulary = $form[$key]['#vocabulary'];
      $vocabulary_row =& $form[$key];
      $row = array();
      $row[] = drupal_render($vocabulary_row['name']);
      switch (_termcase_vocabulary_termcase($vocabulary->machine_name)) {
        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('First character of each word uppercase');
          break;
        default:
          $row[] = t('None');
      }
      if (isset($vocabulary_row['weight'])) {
        $vocabulary_row['weight']['#attributes']['class'] = array(
          'vocabulary-weight',
        );
        $row[] = drupal_render($vocabulary_row['weight']);
      }
      $row[] = drupal_render($vocabulary_row['edit']);
      $row[] = drupal_render($vocabulary_row['list']);
      $row[] = drupal_render($vocabulary_row['add']);
      $rows[] = array(
        'data' => $row,
        'class' => array(
          'draggable',
        ),
      );
    }
  }
  $header = array(
    t('Vocabulary name'),
    t('Case conversion'),
  );
  if (isset($form['actions'])) {
    $header[] = t('Weight');
    drupal_add_tabledrag('taxonomy', 'order', 'sibling', 'vocabulary-weight');
  }
  $header[] = array(
    'data' => t('Operations'),
    'colspan' => '4',
  );
  return theme('table', array(
    'header' => $header,
    'rows' => $rows,
    'empty' => t('No vocabularies available. <a href="@link">Add vocabulary</a>.', array(
      '@link' => url('admin/structure/taxonomy/add'),
    )),
    'attributes' => array(
      'id' => 'taxonomy',
    ),
  )) . drupal_render_children($form);
}