getValue())) { throw new LocalizedException(__('Invalid Ip Address.')); } $ipIsValid = (bool)filter_var($this->getValue(), FILTER_VALIDATE_IP); if (!$ipIsValid) { throw new LocalizedException(__('Invalid Ip Address.')); } return parent::beforeSave(); } }