I’m running out of gas on this one.
I’m running getResources from inside a snippet to do an A to Z links glossary page.
It works perfectly if I create my own $where scriptProperty like this ($v is the letter I’m looking for as the first letter of the pagetitle):
<?php
$local_where = array(
'pagetitle' . ':LIKE' => $v . '%',
);
$scriptProperties['where'] = $modx->toJSON($local_where);
$resources = $modx->runSnippet('getResources',$scriptProperties);
The problem is that I’d like to merge that in as an AND condition with any JSON-encoded getResources criteria sent in the snippet’s &where property. I’ve spent the day trying various versions of creating an array from the &where scriptProperty with fromJSON(), merging the two arrays, and running toJSON() on the new array, but getResources always returns all resources on every call. I assume that means getResources couldn’t make sense of the $where I sent.
I also tried some PHP code I found using array_values on one of the arrays, but couldn’t make that work either. I’m stumped.
A related problem: I’d like to let users send the &resources property to include extra resources, but of course getResources then includes them on every call regardless of the letter restriction (though it works fine to exclude resources). I suspect that’s insoluble, but figured it couldn’t hurt to ask.