<?php
$filters["custom"]["personnelFilter"] = array("PersonnelCompany1,PersonnelCompany2,PersonnelCompany3","personnelFilter");
if (!function_exists("personnelFilter")) {
function personnelFilter($resource) {
global $modx;
if ($resource['PersonnelCompany1'] == $modx->documentIdentifier || $resource['PersonnelCompany2'] == $modx->documentIdentifier || $resource['PersonnelCompany3'] == $modx->documentIdentifier) {
return 0;
} else {
return 1;
}
}
}
?>
An important thing to note is that $modx->documentIdentifier returns the current documents ID and not the document being filtered by Ditto. Use $resource[’id’] instead.
Looking at the example filter, there’s no usage of thsi first parameter within the callback function. Does it mean these ’source of the filter’ are the only variables passed into the callback function?
The first item in the array is the source of the filter comma separated.
Can you copy and paste your snippet call here?I don’t have the original any longer but it was something like:
[!Ditto? &parents=`19` &display=`5` &debug=`0` &extenders=`personnel`!]