expand_radios

Definition

expand_radios($element)
includes/form.inc, line 1263

Description

Roll out a single radios element to a list of radios, using the options array as index.

Related topics

Namesort iconDescription
Form generationFunctions to enable the processing and display of HTML forms.

Code

<?php
function expand_radios($element) {
  if (count($element['#options']) > 0) {
    foreach ($element['#options'] as $key => $choice) {
      if (!isset($element[$key])) {
        $element[$key] = array('#type' => 'radio', '#title' => $choice, '#return_value' => check_plain($key), '#default_value' => $element['#default_value'], '#attributes' => $element['#attributes'], '#parents' => $element['#parents'], '#spawned' => TRUE);
      }
    }
  }
  return $element;
}
?>
 
 

Drupal is a registered trademark of Dries Buytaert.