lib: Fix Number::isValid()
- Calls $this->translate() - Always performs is_numeric check, even if the element is not required
This commit is contained in:
parent
947d5c6190
commit
e8c21868ff
|
@ -134,8 +134,8 @@ class Number extends FormElement
|
|||
{
|
||||
$this->setValue($value);
|
||||
$value = $this->getValue();
|
||||
if (! is_numeric($value)) {
|
||||
$this->addError(sprintf($this->translate('\'%s\' is not a valid number'), $value));
|
||||
if ($this->isRequired() && ! is_numeric($value)) {
|
||||
$this->addError(sprintf(t('\'%s\' is not a valid number'), $value));
|
||||
return false;
|
||||
}
|
||||
return parent::isValid($value, $context);
|
||||
|
|
Loading…
Reference in New Issue