Hey all,
I am building a REST API and I am building an object Array. I’m attempting to use runSnippet “getimagelist” to return a value but it is not parsing the tpl. Here’s my code:
$objectArray = array(
'id' => $id,
'filters' => $this->object->getTVValue(2),
'banner' => $this->modx->runSnippet('getImageList', [
'tvname' => 'bg_img',
'tpl' => 'RESTbg_slideTpl',
'limit' => '1',
'where' => '{"published:=":"1"}',
])
);
and this is the response that I got back
{"success":true,"message":"","object":{"id":"208","filters":"bb||ag||aw||bs||bs2||cw||bm||gd||lc||tt||ky||kn||bq||ht||gy||bl||mf||tc","banner":"[[!+image_bg]]"},"code":200}
Any ideas why it is not parsing the chunk? Also, I noticed that if I dont include an instance of “$this->object->getTVValue(somevalue)” within my object, the runsnippet does not run and I get an empty return.
$objectArray = array(
'id' => $id,
'banner' => $this->modx->runSnippet('getImageList', [
'tvname' => 'bg_img',
'tpl' => 'RESTbg_slideTpl',
'limit' => '1',
'where' => '{"published:=":"1","servicecountries:find_in_set":"bb"}',
])
);
Result
{"success":true,"message":"","object":{"id":"208","banner":""},"code":200}
Why would that happen?