1 form_example_elements.inc form_type_form_example_checkbox_value($element, $input = FALSE)

Value callback for form_example_checkbox element type.

Copied from form_type_checkbox_value().

Parameters

array $element: The form element whose value is being populated.

mixed $input: The incoming input to populate the form element. If this is FALSE, meaning there is no input, the element's default value should be returned.

Return value

int: The value represented by the form element.

File

modules/examples/form_example/form_example_elements.inc, line 212
This is an example demonstrating how a module can define custom form and render elements.

Code

function form_type_form_example_checkbox_value($element, $input = FALSE) {
  if ($input === FALSE) {
    return isset($element['#default_value']) ? $element['#default_value'] : 0;
  }
  else {
    return isset($input) ? $element['#return_value'] : 0;
  }
}