1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-09 08:17:12 +02:00

Update to previous commit

This commit is contained in:
Ryan Cramer
2024-01-14 11:54:25 -05:00
parent 3717a85f3b
commit 1216340a46

View File

@@ -160,16 +160,14 @@ class InputfieldInteger extends Inputfield {
if($key === 'value') {
$value = $this->sanitizeValue($value);
if(strlen("$value") && !$this->isInRange($value)) {
if($value) {
// apply the following only for non-zero values
$min = (string) $this->attr('min');
$max = (string) $this->attr('max');
$any = $this->_('any'); // referring to “any” minimum or maximum number
if(!strlen("$min")) $min = $any;
if(!strlen("$max")) $max = $any;
$this->error(sprintf($this->_('Specified value %3$s removed because it is out of bounds (min=%1$s, max=%2$s)'), $min, $max, $value));
}
$value = $this->val(); // restore previous value
// apply the following only for non-zero values
$min = (string) $this->attr('min');
$max = (string) $this->attr('max');
$any = $this->_('any'); // referring to “any” minimum or maximum number
if(!strlen("$min")) $min = $any;
if(!strlen("$max")) $max = $any;
$this->error(sprintf($this->_('Specified value %3$s removed because it is out of bounds (min=%1$s, max=%2$s)'), $min, $max, $value));
$value = $this->val();
}
} else if($key === 'min' || $key === 'max') {
if(strlen("$value")) {