You are here

function theme_radio in Drupal 4

Same name and namespace in other branches
  1. 5 includes/form.inc \theme_radio()
  2. 6 includes/form.inc \theme_radio()
  3. 7 includes/form.inc \theme_radio()

Format a radio button.

Parameters

$element: An associative array containing the properties of the element. Properties used: required, return_value, value, attributes, title, description

Return value

A themed HTML string representing the form item group.

Related topics

File

includes/form.inc, line 722

Code

function theme_radio($element) {
  _form_set_class($element, array(
    'form-radio',
  ));
  $output = '<input type="radio" ';
  $output .= 'name="' . $element['#name'] . '" ';
  $output .= 'value="' . $element['#return_value'] . '" ';
  $output .= check_plain($element['#value']) == $element['#return_value'] ? ' checked="checked" ' : ' ';
  $output .= drupal_attributes($element['#attributes']) . ' />';
  if (!is_null($element['#title'])) {
    $output = '<label class="option">' . $output . ' ' . $element['#title'] . '</label>';
  }
  return theme('form_element', NULL, $output, $element['#description'], $element['#id'], $element['#required'], form_get_error($element));
}