Quote from: BobRay at Apr 04, 2017, 02:21 AM
This question doesn't belong here. Please start a new topic.
Thank you for the answer Bob! But I'm using Lingua component in my project, therefore I decided to add my question in this thread.
I've solve the issue via lexicon.
Firstly I created lexicon entries for the necessary languages.
Then I put following code to TV listbox:
@EVAL $modx->lexicon->load('[[+cultureKey]]:site:default');return $modx->lexicon('Eyes_values',array(), '[[+cultureKey]]');
And then I changed Lingua plugin 'OnResourceTVFormRender' event and put following code there after 350 row. The code replaces [[+cultureKey]] placeholder to the necessary language for the extra TV fields.
$tv_obj = $modx->getObject('modTemplateVar', $tvId);
$tv_obj_elem = '';
if ($tv_obj) {
$tv_obj_elem = $tv_obj->get('elements');
$tv_obj_elem = str_replace('[[+cultureKey]]', $language['lang_code'], $tv_obj_elem);
}
// Hack TV's value because renderInput ignores empty value
$tv->set('value', $content);
$tv->set('elements', $tv_obj_elem);
$inputForm = $tv->renderInput($resource, array(
'elements' => $tv_obj_elem,
'value' => $content
));
Hope it helps somebody.