You are here

function _flexslider_validate_positive_integer in Flex Slider 7

Same name and namespace in other branches
  1. 7.2 flexslider.admin.inc \_flexslider_validate_positive_integer()

Validate a form element that should have an integer value.

1 string reference to '_flexslider_validate_positive_integer'
flexslider_option_elements in ./flexslider.admin.inc
This function returns an array defining the form elements used to edit the different options.

File

./flexslider.admin.inc, line 337
Administrative page callbacks for the flexslider module.

Code

function _flexslider_validate_positive_integer($element, &$form_state) {
  $value = $element['#value'];
  if ($value !== '' && (!is_numeric($value) || intval($value) != $value || $value < 0)) {
    form_error($element, t('%name must be a positive integer.', array(
      '%name' => $element['#title'],
    )));
  }
}