Closed BenceSzalai closed 3 years ago
For anyone interested, a solution using a Snippet is:
$subject = $modx->getOption('subject', $scriptProperties, '');
$operand = $modx->getOption('operand', $scriptProperties, []);
return ! in_array( $subject, $operand, true );
and the tag for that would be:
[[getImageList? ... &where=`{"title:snippet:IsNotInList":["string1","string2"]}`]]
where title
is the migx field we want to make sure is not "string1" or "string2" and IsNotInList
is the name of the 3 line snippet above!
It's an issue but more like questions as well.
I've been trying to use getImageList to return a list of MIGX TVs that does NOT match a set of criteria, but failed to do so. I could not find particularily detailed documentation above the
&where
property of the getImageList snippet, so I've assumed it would work the same way as xPDOQuery.where works (https://docs.modx.com/current/en/extending-modx/xpdo/class-reference/xpdoquery/xpdoquery.where). But after trying in different ways I found out that getImageList only supports a subset of the xPDOQuery where syntax. With my particular goal in mind I've tried to use:&where=`{"title:!=":"string1", "AND:title:!=":"string2"}`
and this too:&where=`{"title:NOT IN":["string1","string2"]}`
but both failed to produce any results.After some debuging I've found out (or at least it looks like to me) that
Migx::filterItems()
does not support logical operators before field names (theOR:
part) nor does it support theNOT IN
operator.My questions are:
(PS: while looking at
Migx::filterItems()
I've noticed&where
could accept a custom Snippet to be used for filtering, so I'll try to use that for now, but the question is the same for that too: is there documentation about that anywhere?)