You are here

function theme_checkbox_tree in Taxonomy Term Reference Tree Widget 7

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

Returns HTML for a checkbox_tree form element.

Parameters

$variables: An associative array containing:

  • element: An associative array containing the properties of the element.
1 theme call to theme_checkbox_tree()
term_reference_tree_element_info in ./term_reference_tree.module
Implements hook_element_info().

File

./term_reference_tree.widget.inc, line 364

Code

function theme_checkbox_tree($variables) {
  $element = $variables['element'];
  $element['#children'] = drupal_render_children($element);
  $attributes = array();
  if (isset($element['#id'])) {
    $attributes['id'] = $element['#id'];
  }
  $attributes['class'][] = 'term-reference-tree';
  if (form_get_error($element)) {
    $attributes['class'][] = 'error';
  }
  if (!empty($element['#required'])) {
    $attributes['class'][] = 'required';
  }
  if (array_key_exists('#start_minimized', $element) && $element['#start_minimized']) {
    $attributes['class'][] = 'term-reference-tree-collapsed';
  }
  if (array_key_exists('#cascading_selection', $element) && $element['#cascading_selection']) {
    $attributes['class'][] = 'term-reference-tree-cascading-selection';
  }
  if (array_key_exists('#track_list', $element) && $element['#track_list']) {
    $attributes['class'][] = 'term-reference-tree-track-list-shown';
  }
  if (!empty($element['#attributes']['class'])) {
    $attributes['class'] = array_merge($attributes['class'], $element['#attributes']['class']);
  }
  return '<div' . drupal_attributes($attributes) . '>' . (!empty($element['#children']) ? $element['#children'] : '') . '</div>';
}