You are here

function theme_taxonomy_manager_tree_checkbox in Taxonomy Manager 7

Same name and namespace in other branches
  1. 5 taxonomy_manager.module \theme_taxonomy_manager_tree_checkbox()
  2. 6.2 taxonomy_manager.module \theme_taxonomy_manager_tree_checkbox()
  3. 6 taxonomy_manager.module \theme_taxonomy_manager_tree_checkbox()

themes a checkbox, where a label can optional contain a link

File

./taxonomy_manager.module, line 1076
Taxonomy Manager

Code

function theme_taxonomy_manager_tree_checkbox($variables) {
  $element = $variables['element'];
  $element['#attributes']['type'] = 'checkbox';
  element_set_attributes($element, array(
    'id',
    'name',
    '#return_value' => 'value',
  ));

  // Unchecked checkbox has #value of integer 0.
  if (!empty($element['#checked'])) {
    $element['#attributes']['checked'] = 'checked';
  }
  _form_set_class($element, array(
    'form-checkbox',
  ));
  $output = '<input' . drupal_attributes($element['#attributes']) . ' />';
  $title = $element['#title'];
  if (isset($element['#link'])) {
    $attr = array();
    $attr["class"][] = "term-data-link";
    $attr["class"][] = "term-data-link-id-" . $element['#return_value'];
    if (isset($element['#extra_info'])) {
      $attr["title"] = $element['#extra_info'];
    }
    $title = l($title, $element['#link'], array(
      'attributes' => $attr,
    ));
  }
  else {
    $title = check_plain($title);
  }
  $element['#children'] = '<label class="option">' . $output . ' ' . $title . '</label>';
  $element['#title_display'] = 'none';
  return theme('form_element', array(
    'element' => $element,
  ));
}