You are here

function theme_taxonomy_manager_tree_radio in Taxonomy Manager 7

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

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

File

./taxonomy_manager.module, line 1110
Taxonomy Manager

Code

function theme_taxonomy_manager_tree_radio($variables) {
  $element = $variables['element'];
  $element['#attributes']['type'] = 'radio';
  element_set_attributes($element, array(
    'id',
    'name',
    '#return_value' => 'value',
  ));
  if (isset($element['#return_value']) && $element['#value'] !== FALSE && $element['#value'] == $element['#return_value']) {
    $element['#attributes']['checked'] = 'checked';
  }
  _form_set_class($element, array(
    'form-radio',
  ));
  $output = '<input' . drupal_attributes($element['#attributes']) . ' />';
  $title = $element['#title'];
  if (isset($element['#link'])) {
    $title = l($title, $element['#link'], array(
      'attributes' => array(
        "class" => "term-data-link term-data-link-id-" . $element['#return_value'],
      ),
    ));
  }
  else {
    $title = check_plain($title);
  }
  $element['#children'] = '<label class="option">' . $output . ' ' . $title . '</label>';
  $element['#title_display'] = 'none';
  return theme('form_element', array(
    'element' => $element,
  ));
}