Prepares a #type 'radio' render element for theme_input().
array $element: An associative array containing the properties of the element. Properties used: #required, #return_value, #value, #attributes, #title, #description.
Note: The input "name" attribute needs to be sanitized before output, which is currently done by initializing Drupal\Core\Template\Attribute with all the attributes.
array The $element with prepared variables ready for theme_input().
function form_pre_render_radio($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_attributes($element, array(
'form-radio',
));
return $element;
}