You are here

function rules_ui_element_ip_address_validate in Rules 7.2

FAPI callback to validate an IP address.

1 string reference to 'rules_ui_element_ip_address_validate'
RulesDataUIIPAddress::inputForm in ui/ui.data.inc
Implements RulesDataDirectInputFormInterface::inputForm().

File

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

Code

function rules_ui_element_ip_address_validate($element, &$form_state) {
  $value = $element['#value'];
  if ($value != '' && !filter_var($value, FILTER_VALIDATE_IP)) {
    form_error($element, t('%name is not a valid IP address.', array(
      '%name' => $element['#title'],
    )));
  }
}