You are here

function theme_checkbox_tree_track_list in Taxonomy Term Reference Tree Widget 7

Same name and namespace in other branches
  1. 7.2 term_reference_tree.widget.inc \theme_checkbox_tree_track_list()

Shows a list of items that have been checked. The display happens on the client-side. Use this function to theme the element's label, and the "nothing selected" message.

Parameters

$variables: Variables available for theming.

1 theme call to theme_checkbox_tree_track_list()
term_reference_tree_element_info in ./term_reference_tree.module
Implements hook_element_info().

File

./term_reference_tree.widget.inc, line 476

Code

function theme_checkbox_tree_track_list($variables) {

  // Should the label be singular or plural?
  // Depends on cardinality of term field.
  static $nothingselected;
  if (!$nothingselected) {
    $nothingselected = t('[Nothing selected]');

    // Add the "Nothing selected" text. To style it,
    // replace it with whatever you want. Could do this with a file instead.
    drupal_add_js('var termReferenceTreeNothingSelectedText = "' . $nothingselected . '";', 'inline');
  }
  $label = format_plural($variables['element']['#max_choices'], t('Selected item (click the item to uncheck it)'), t('Selected items (click an item to uncheck it)'));
  $output = '<div class="term-reference-track-list-container">';
  $output .= '<div class="term-reference-track-list-label">' . $label . '</div>';
  $output .= '<ul class="term-reference-tree-track-list"><li class="term_ref_tree_nothing_message">' . $nothingselected . '</li></ul>';
  $output .= '</div>';
  return $output;
}