You are here

function _galleria_validate_integer_boolean in Galleria 7

Validate a form element that should have an integer or boolean value.

1 string reference to '_galleria_validate_integer_boolean'
galleria_option_elements in includes/galleria.admin.inc
This function returns an array defining the form elements used to edit the different options.

File

includes/galleria.admin.inc, line 722
Administrative page callbacks for the galleria module.

Code

function _galleria_validate_integer_boolean($element, &$form_state) {
  $value = $element['#value'];
  if ($value !== '' && strtolower($value) !== 'true' && strtolower($value) !== 'false' && (!is_numeric($value) || intval($value) != $value || $value < 0)) {
    form_error($element, t('%name must be a positive integer or one of the boolean strings \'true\' or \'false\'.', array(
      '%name' => $element['#title'],
    )));
  }
}