/** * @param mixed $varInput * @return mixed */ protected function validator($varInput) { $this->rgxp = 'digit'; $varInput = $this->encode($varInput); if ($this->unsigned && $varInput < 0) { $varInput = $varInput * -1; } return parent::validator(trim($varInput)); }
/** * @param mixed $varInput * @return mixed */ protected function validator($varInput) { // Get language id $intId = $this->activeRecord ? $this->activeRecord->{$this->strName} : $GLOBALS['TL_CONFIG'][$this->strName]; // Check if translation fields should not be empty saved if (!$GLOBALS['TL_CONFIG']['dontfillEmptyTranslationFields']) { // Fill all empty fields with the content of the fallback field $varInput = WidgetUtil::addFallbackValueToEmptyField($varInput); parent::validator($varInput); } else { // Check only the first field parent::validator($varInput[key($varInput)]); } // Check if array if (is_array($varInput)) { if (!parent::hasErrors()) { // Save values and return fid return TranslationFieldsModel::saveValuesAndReturnFid($varInput, $intId); } } return $intId; }