SOLVED - SEE FIRST ANSWER
I am trying to set up a custom imageRenderer Snippet for my Collections view. I want to display the first image of a MIGX-TV which hosts some images.
So I made this Snippet:
$row = $modx->getOption('row', $scriptProperties, '');
$rowId = $row['id'];
$modx->setPlaceholder('getId', $rowId);
$gR = $modx->runSnippet('getResources', [
'parents' => '-1',
'resources' => $rowId,
'tpl' => 'ref-image-id'
]);
return '<a href="[[++site_url]]manager/?a=resource/update&id=' . $row['id'] . '" title="' . $row['pagetitle'] . '"><img src="' . $gR . '" width="60" ></a>';
In my Chunk
ref-image-id I have this (only works cached):
[[getImageList?
&tvname=`ref-images`
&tpl=`ref-image-item`
&docid=`[[+getId]]`
&limit=`1`
]]
The
ref-image-item Chunk:
On my Collections view all of the images have the path of the first resource. The image itself ([[+image]]) is correct.
What I get is:
path/of/
resource-1/car.jpg
path/of/
resource-1/flower.jpg
path/of/
resource-1/house.jpg
when it should be:
path/of/
resource-1/car.jpg
path/of/
resource-2/flower.jpg
path/of/
resource-3/house.jpg
I have tried this without the placeholder and inside my getImageList call using &docid=`[[+id]]` - same problem.
[ed. note: aaantz last edited this post 6 years, 8 months ago.]