You are here

function facetapi_element_validate_integer in Facet API 7

Same name and namespace in other branches
  1. 6.3 facetapi.admin.inc \facetapi_element_validate_integer()
  2. 7.2 facetapi.admin.inc \facetapi_element_validate_integer()

Helper form element validator: integer.

See also

_element_validate_integer

1 string reference to 'facetapi_element_validate_integer'
facetapi_facet_display_form in ./facetapi.admin.inc
Form constructor for the facet display settings form.

File

./facetapi.admin.inc, line 742
Admin page callbacks for the Facet API module.

Code

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