function rules_ui_element_ip_address_validate

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 729

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'],
        )));
    }
}