What, exactly does a Static Resource use for its output? I have this code
if($modx->resource->get('class_key') == 'modStaticResource') {
$msource = $modx->resource->getTVValue('Source');
$source = $modx->getObject('modMediaSource', $msource);
$properties = $source->getProperties();
$path = $properties['basePath']['value'];
$content = $modx->resource->get('content');
$path = $path . $content;
$output = &$modx->resource->_output;
$output = $path;
}
return;
It does exactly what I expect it to do, it replaces the _output with the full path. But MODx doesn't use this value when processing Static Resources!
My Media Source has "/var/www/dev/downloads/", and the content of the Static Resource is the rest of the path: "Documents/document1.pdf". The above code gets the Media Source basPath and the Static Resource's content, and concatinates them. The $output will return as "/var/www/dev/downloads/Documents/document1.pdf". However, MODx ends up with "/var/www/dev/public_html/Documents/document1.pdf". So it's just adding the site's base path to the Static Resources content, ignoring the modified _output.
Static resources are processed in modresponse.class.php on line 181-182, after the OnWebPagePrerender event, and just before the document is flushed. So what is it using to process, and how can I modify it on the OnWebPagePrerender event?