Same name and namespace in other branches
  1. 4.7.x includes/form.inc \checkboxes_value()

Helper function to load value from default value for checkboxes.

Related topics

File

includes/form.inc, line 1239

Code

function checkboxes_value(&$form) {
  $value = array();
  foreach ((array) $form['#default_value'] as $key) {
    $value[$key] = 1;
  }
  $form['#value'] = $value;
}