/** * @param mixed $varInput * @return mixed */ protected function validator($varInput) { // Get array with language id $arrData = $this->activeRecord ? $this->activeRecord->{$this->strName} : $GLOBALS['TL_CONFIG'][$this->strName]; if (is_array($varInput['value'])) { // 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['value'] = \TranslationFieldsWidgetHelper::addFallbackValueToEmptyField($varInput['value']); parent::validator($varInput['value']); } else { // Check only the first field parent::validator($varInput['value'][key($varInput['value'])]); } } $arrData = deserialize($arrData); // Save values and return fid $varInput['value'] = \TranslationFieldsWidgetHelper::saveValuesAndReturnFid($varInput['value'], $arrData['value']); return $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 = \TranslationFieldsWidgetHelper::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 \TranslationFieldsWidgetHelper::saveValuesAndReturnFid($varInput, $intId); } } return $intId; }