Hello everyone, hello @glodsky!
I haven't found the solution to CFK Editor yet, honestly - I've not been even looking for it yet :/ BUT:
I found a little bug but very annoying. I had a problem with lingua.getValue snippet. It works great on it's own and get all TV's values well. But if used with getResources from inside a tpl Chunk it does not get (or output) the right value of Template Variables and uses the default value. And I have to notice that I took care of these with getResources:
- &includeTVs=`1`
- &processTVs=`1`
And now my example:
This the line wich should display the right link to an image according to the language key:
<img src="[[lingua.getValue:default=`[[+art.image]]`? &id=`[[+id]]` &field=`art.image`]]" />
But it doesn't work inside getResources. All standard fields language is switching right - content, pagetitle, etc.
From within this template:
<img src="[[lingua.getValue:default=`[[*art.image]]`? &id=`[[*id]]` &field=`art.image`]]" />
it works great.
So I decided to look inside the snippet code, although I'm rather a poor backend developer
And I did some experiments with lingua.getValue:
Original code:
// try TV
else {
$tv = $modx->getObject('modTemplateVar', array(
'name' => $field,
));
if ($tv) {
$linguaSiteTmplvarContentvalues = $modx->getObject('linguaSiteTmplvarContentvalues', array(
'lang_id' => $langObj->get('id'),
'tmplvarid' => $tv->get('id'),
'contentid' => $id,
));
if ($linguaSiteTmplvarContentvalues) {
$value = $linguaSiteTmplvarContentvalues->get('value');
$tv->setValue($tv->get('id'), $value);
}
$output = $tv->renderOutput($resource->get('id'));
}
}
And the code after makeovers:
// try TV
else {
$tv = $modx->getObject('modTemplateVar', array(
'name' => $field,
));
if ($tv) {
$linguaSiteTmplvarContentvalues = $modx->getObject('linguaSiteTmplvarContentvalues', array(
'lang_id' => $langObj->get('id'),
'tmplvarid' => $tv->get('id'),
'contentid' => $id,
));
if ($linguaSiteTmplvarContentvalues) {
$value = $linguaSiteTmplvarContentvalues->get('value');
// $tv->setValue($tv->get('id'), $value);
}
// $output = $tv->renderOutput($resource->get('id'));
$output = $value;
}
}
I've just commented out two lines and instead of rendering the TV just outputing the found right value. And it started to work poroprerly. I'm not an expert so I hope the author will improve the code. Meanwhile you can use this solution if you cope with the same problem I did.
Greetings
[ed. note: rajciok last edited this post 9 years, 5 months ago.]