You are here

function theme_checkbox_tree_item in Taxonomy Term Reference Tree Widget 7

Same name and namespace in other branches
  1. 8 term_reference_tree.module \theme_checkbox_tree_item()
  2. 7.2 term_reference_tree.widget.inc \theme_checkbox_tree_item()

This function prints a single item in the tree, followed by that item's children (which may be another checkbox_tree_level).

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

File

./term_reference_tree.widget.inc, line 433

Code

function theme_checkbox_tree_item($variables) {
  $element = $variables['element'];
  $children = element_children($element);
  $output = '';
  if ($element['#has_children']) {
    if ($element['#level_start_minimized']) {
      $id = drupal_html_id('term-reference-tree-' . $children[0]);
      $output .= '<div id="' . $id . '" data-tid="' . $children[0] . '" class="term-reference-tree-button term-reference-tree-collapsed"></div>';
    }
    else {
      $output .= '<div class="term-reference-tree-button"></div>';
    }
  }
  elseif (!$element['#leaves_only']) {
    $output .= '<div class="no-term-reference-tree-button"></div>';
  }
  foreach ($children as $child) {
    $output .= drupal_render($element[$child]);
  }
  return $output;
}