You are here

function select_or_other_checkbox_value in Select (or other) 6.2

Helper function to determine the value for a checkbox form element.

Drupal core cannot discern the difference between an unchecked checkbox and a checked checkbox that has a value of '0'. This value callback will return NULL instead of an integer 0 for checkboxes that are not checked.

See also

form_type_checkbox_value()

1 string reference to 'select_or_other_checkbox_value'
select_or_other_expand_checkboxes in ./select_or_other.module
Element process callback for Select (or other) checkboxes.

File

./select_or_other.module, line 241
The Select (or other) module.

Code

function select_or_other_checkbox_value($form, $edit = FALSE) {
  if ($edit !== FALSE) {
    if (empty($form['#disabled'])) {
      return $edit !== NULL ? $form['#return_value'] : NULL;

      // 0 in core.
    }
    else {
      return $form['#default_value'];
    }
  }
}