You are here

function jquerymobile_pre_render_checkboxes in jQuery Mobile module 7

Same name and namespace in other branches
  1. 7.2 jquerymobile.module \jquerymobile_pre_render_checkboxes()

custom pre_render function for checkboxes if a checkboxes element has only 1 option, leave it alone; otherwise mark it as multiple so that we leave it alone when transforming single-value checkboxes to slide switches

1 string reference to 'jquerymobile_pre_render_checkboxes'
jquerymobile_element_info_alter in ./jquerymobile.module
Implements hook_element_info_alter().

File

./jquerymobile.module, line 106
Provides the jQuery Mobile library to modules and themes that request it.

Code

function jquerymobile_pre_render_checkboxes($element) {
  $count = count($element['#options']);
  if (count($element['#options']) != 1) {
    foreach ($element['#options'] as $key => $choice) {
      $element[$key]['#multiple'] = TRUE;
    }
  }
  return $element;
}