function supersized_form_process_radios in Supersized 8
Same name and namespace in other branches
- 7 supersized.module \supersized_form_process_radios()
A radios process function.
We need to customized the theme wrapper for the radio buttons so labels support full HTML.
2 string references to 'supersized_form_process_radios'
- supersized_field_instance_settings_form in ./
supersized.field.inc - Implements hook_field_instance_settings_form().
- supersized_node_settings_form in ./
supersized.module - Supersized setting form for node.
File
- ./
supersized.module, line 175 - Supersized module file.
Code
function supersized_form_process_radios($element) {
if (count($element['#options']) > 0) {
$weight = 0;
foreach ($element['#options'] as $key => $choice) {
// Maintain order of options as defined in #options, in case the element
// defines custom option sub-elements, but does not define all option
// sub-elements.
$weight += 0.001;
$element += array(
$key => array(),
);
// Generate the parents as the autogenerator does, so we will have a
// unique id for each radio button.
$parents_for_id = array_merge($element['#parents'], array(
$key,
));
$element[$key] += array(
'#type' => 'radio',
'#title' => $choice,
// The key is sanitized in drupal_attributes() during output from the
// theme function.
'#return_value' => $key,
// Use default or FALSE. A value of FALSE means that the radio button is
// not 'checked'.
'#default_value' => isset($element['#default_value']) ? $element['#default_value'] : FALSE,
'#attributes' => $element['#attributes'],
'#parents' => $element['#parents'],
'#id' => drupal_html_id('edit-' . implode('-', $parents_for_id)),
'#ajax' => isset($element['#ajax']) ? $element['#ajax'] : NULL,
'#weight' => $weight,
'#theme_wrappers' => array(
'supersized_form_element',
),
);
}
}
return $element;
}