Skip to content

Instantly share code, notes, and snippets.

@dstogov
Created May 15, 2019 14:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dstogov/52a44c1ad3955ef5edbbc490f16a0e75 to your computer and use it in GitHub Desktop.
Save dstogov/52a44c1ad3955ef5edbbc490f16a0e75 to your computer and use it in GitHub Desktop.
<?php
function form_process_radios($element) {
$weight = 0;
foreach ($element['#options'] as $key => $choice) {
$weight += 0.001;
$element += array($key => array());
$element[$key] += array(
'#type' => 'radio',
'#weight' => $weight,
);
}
return $element;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment