function boolean_field_widget_value in Boolean Field 7
Form element value callback for the boolean field element.
1 string reference to 'boolean_field_widget_value'
- boolean_field_widget_form in ./
boolean.module - Implements hook_field_widget_form().
File
- ./
boolean.module, line 403 - Defines boolean field type.
Code
function boolean_field_widget_value($element, $input = FALSE, $form_state = array()) {
if ($input === FALSE) {
return isset($element['#default_value']) ? $element['#default_value'] : 0;
}
else {
// With 3 states, a value of -1 is also considered TRUE. So check for 1.
return $input == 1 ? $input : 0;
}
}