Changeset View
Changeset View
Standalone View
Standalone View
core/kernel/utility/formatters/multilang_formatter.php
Show First 20 Lines • Show All 245 Lines • ▼ Show 20 Line(s) | |||||
if (!$master_field) { | if (!$master_field) { | ||||
return ; | return ; | ||||
} | } | ||||
// moved here from Parse, because at Parse time not all of the fields may be set - this is extremly actual, when working with PopulateMlFields mode | // moved here from Parse, because at Parse time not all of the fields may be set - this is extremly actual, when working with PopulateMlFields mode | ||||
$lang = $this->Application->GetVar('m_lang'); | $lang = $this->Application->GetVar('m_lang'); | ||||
$def_lang = $this->Application->GetDefaultLanguageId(); | $def_lang = $this->Application->GetDefaultLanguageId(); | ||||
if ( !$this->Application->GetVar('allow_translation') && ($lang != $def_lang) && $object->isRequired($field) ) { | if ( $this->Application->isWebRequest() ) { | ||||
$allow_translation = $this->Application->GetVar('allow_translation'); | |||||
} | |||||
else { | |||||
$allow_translation = false; | |||||
} | |||||
if ( !$allow_translation && ($lang != $def_lang) && $object->isRequired($field) ) { | |||||
$def_lang_field = 'l' . $def_lang . '_' . $master_field; | $def_lang_field = 'l' . $def_lang . '_' . $master_field; | ||||
if ( !$object->ValidateRequired($def_lang_field, $options) ) { | if ( !$object->ValidateRequired($def_lang_field, $options) ) { | ||||
$object->SetError($master_field, 'primary_lang_required'); | $object->SetError($master_field, 'primary_lang_required'); | ||||
if ( $object->isField($def_lang_field) ) { | if ( $object->isField($def_lang_field) ) { | ||||
$object->SetError($def_lang_field, 'primary_lang_required'); | $object->SetError($def_lang_field, 'primary_lang_required'); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Line(s) | |||||
* @access public | * @access public | ||||
*/ | */ | ||||
public function Parse($value, $field_name, &$object) | public function Parse($value, $field_name, &$object) | ||||
{ | { | ||||
if ($value == '') return NULL; | if ($value == '') return NULL; | ||||
return $value; | return $value; | ||||
} | } | ||||
} | } | ||||
No newline at end of file |