[[migxResourceMediaPath? &pathTpl=`assets/resourceimages/{id}/`]]
[[migxResourceMediaPath? &pathTpl=`assets/resourceimages/[[BabelTranslation? &contextKey=`web` &resourceId=`{id}`]]/`]]
This question has been answered by Bruno17. See the first response.
$docid = $modx->runSnippet('BabelTranslation', array('contextKey' => 'web', 'resourceId' => $docid));
<?php $pathTpl = $modx->getOption('pathTpl', $scriptProperties, ''); $docid = $modx->getOption('docid', $scriptProperties, ''); if (empty($docid) && $modx->getPlaceholder('docid')) { $docid = $modx->getPlaceholder('docid'); } if (empty($docid)) { if (is_Object($modx->resource)) { $docid = $modx->resource->get('id'); } else { $parsedUrl = parse_url($_SERVER['HTTP_REFERER']); parse_str($parsedUrl['query'], $parsedQuery); if (isset($parsedQuery['amp;id'])) { $docid = $parsedQuery['amp;id']; } elseif (isset($parsedQuery['id'])) { $docid = $parsedQuery['id']; } } } // Same Media Source for all languages $modx->log(modX::LOG_LEVEL_ERROR, 'Result: '.$modx->runSnippet('BabelTranslation', array('contextKey' => 'web', 'resourceId' => $docid))); $docid = $modx->runSnippet('BabelTranslation', array('contextKey' => 'web', 'resourceId' => $docid)); $path = str_replace('{id}', $docid, $pathTpl); $fullpath = $modx->getOption('base_path') . $path; if (!file_exists($fullpath)) { mkdir($fullpath, 0755, true); } return $path;
$modx->log(modX::LOG_LEVEL_ERROR, 'Result: '.$modx->runSnippet('BabelTranslation', array('contextKey' => 'web', 'resourceId' => $docid)));
<?php if (!is_object($modx->resource)){ $modx->resource = $modx->newObject('modResource'); } $docid = $modx->runSnippet('BabelTranslation', array('contextKey' => 'web', 'resourceId' => $docid)); $modx->log(modX::LOG_LEVEL_ERROR, 'docid migxBabelResourceMediaPath: '.$docid);