mvc: HostnameField validation message

This commit is contained in:
Franco Fichtner 2023-09-22 13:08:13 +02:00
parent 7fab0249f7
commit b3005955c1

View File

@ -41,11 +41,6 @@ class HostnameField extends BaseField
*/
protected $internalIsContainer = false;
/**
* @var string default validation message string
*/
protected $internalValidationMessage = "please specify a valid address (IPv4/IPv6) or hostname";
/**
* @var null when multiple values could be provided at once, specify the split character
*/
@ -158,6 +153,14 @@ class HostnameField extends BaseField
}
}
/**
* {@inheritdoc}
*/
protected function defaultValidationMessage()
{
return gettext('Please specify a valid IP address or hostname.');
}
/**
* retrieve field validators for this field type
* @return array returns Text/regex validator
@ -166,14 +169,14 @@ class HostnameField extends BaseField
{
$validators = parent::getValidators();
if ($this->internalValue != null) {
$validators[] = new HostValidator(array(
'message' => $this->internalValidationMessage,
$validators[] = new HostValidator([
'message' => $this->getValidationMessage(),
'split' => $this->internalFieldSeparator,
'allowip' => $this->internalIpAllowed,
'hostwildcard' => $this->internalHostWildcardAllowed,
'fqdnwildcard' => $this->internalFqdnWildcardAllowed,
'zoneroot' => $this->internalZoneRootAllowed
));
'zoneroot' => $this->internalZoneRootAllowed,
]);
}
return $validators;
}