You are here

function rules_ui_element_integer_validate in Rules 7.2

FAPI validation of an integer element.

Copy of the core Drupal private function _element_validate_integer().

4 string references to 'rules_ui_element_integer_validate'
RulesDataUIEntity::inputForm in ui/ui.data.inc
Implements RulesDataDirectInputFormInterface::inputForm().
RulesDataUIInteger::inputForm in ui/ui.data.inc
Implements RulesDataDirectInputFormInterface::inputForm().
RulesNumericOffsetProcessor::form in modules/rules_core.eval.inc
Overrides RulesDataProcessor::form().
rules_ui_element_duration_process in ui/ui.forms.inc
FAPI process callback for the duration element type.

File

ui/ui.forms.inc, line 701
Rules User Interface forms.

Code

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