I created a snipped that works almost exaclty like BabelTranslation.
The difference...
input id's comma-seperated, output translated id's comma-seperated.
Other parameters are the same.
Example: [[BabelResourceIdArray? &resourceIds=`1,2,3,4,5` &contextKey=`[[++cultureKey]]`]]
Code:
<?php
$babel = $modx->getService('babel', 'Babel', $modx->getOption('babel.core_path', null, $modx->getOption('core_path') . 'components/babel/') . 'model/babel/', $scriptProperties);
if (!($babel instanceof Babel))
return;
/* be sure babel TV is loaded */
if (!$babel->babelTv)
return;
/* if context is NL (default language, here it's nl) return resourceIds */
if ($contextKey == 'nl')
return $scriptProperties['resourceIds'];
/* get snippet properties */
if (!empty($scriptProperties['resourceIds'])) {
$contextKey = $modx->getOption('contextKey', $scriptProperties, '');
$showUnpublished = $modx->getOption('showUnpublished', $scriptProperties, 0);
$ids_array = explode(',', $scriptProperties['resourceIds']);
$resourceId = '';
foreach ($ids_array as $id) {
$id = intval($modx->getOption('resourceId', $scriptProperties, $id)) . ',';
$linkedResources = $babel->getLinkedResources($id);
if (isset($linkedResources[$contextKey])) {
$resource = $modx->getObject('modResource', $linkedResources[$contextKey]);
if ($resource && ($showUnpublished || $resource->get('published') == 1)) {
$resourceId .= $resource->get('id') . ',';
}
}
}
$resourceId = rtrim($resourceId, ',');
return $resourceId;
} else {
return null;
}