В конце концов разобрался. И все стало работать.
Необходимо путь в источнике файлов делать некешируемым [[!migxResourceMediaPath? &pathTpl=assets/images/{id}/
]] Код процессора который я написал для себя: <?php
require_once MODX_CORE_PATH .'components/migx/model/migx/migx.class.php';
class GetDataMIGxProcessor extends modProcessor{
public function initialize(){
$this->setDefaultProperties(array(
'tvname' => '',
'id' => 0, //id ресурса
'randomize' => 0,
'limit' => 0,
'nameMS' => '' //имя MediaSource
));
return parent::initialize();
}
private function GetPath(){
$this->modx->setPlaceholder('docid', $this->getProperty('id'));
$source = $this->modx->getObject('modMediaSource', array('name'=>$this->getProperty('nameMS')));
$this->modx->resource = $this->modx->getObject('modResource', $this->getProperty('id'));
$source->initialize();
$value = $source->getBaseUrl();
//unset($source);
return $value;
}
private function FindFields(xPDOObject $object)
{
$migx = new MIGX($this->modx);
$config_r = $object->get('input_properties');
$config = $config_r['configs'];
//
$q = $this->modx->getObject('migxConfig', array('name'=>$config));
$data = $this->modx->fromJSON(trim($q->get('formtabs'), '[]'));
$res_field = array();
foreach($data['fields'] as $field){
if ($field['inputTVtype'] == 'image' || $field['inputTVtype'] == 'file')
$res_field = $res_field + array($field['field']);
}
unset($migx);
return $res_field;
}
private function GetTVValue($path){
$q = $this->modx->newQuery('modTemplateVar');
$q->innerJoin('modTemplateVarResource', 'v', 'v.tmplvarid = modTemplateVar.id');
$q->where(array('modTemplateVar.name'=> $this->getProperty('tvname'), 'v.contentid' => $this->getProperty('id')));
$q->select(array('v.*, modTemplateVar.input_properties'));
$q->prepare();
$tv = $this->modx->getObject('modTemplateVar', $q);
$keys = $this->FindFields($tv);
$object = $this->modx->fromJSON($tv->get('value'));
$list = array();
$index = 0;
if ($this->getProperty('randomize') != 0)
shuffle($object);
foreach ($object as $tv){
for ($i = 0; count($keys) > $i; $i++){
if(array_key_exists($keys[$i], $tv)){
$tv[$keys[$i]] = implode("", array($path, $tv[$keys[$i]]));
}
}
array_push($list, $tv);
$index++;
if ($this->getProperty('limit') != 0 && $this->getProperty('limit') == $index)
break;
}
//$list['count'] = $index;
return array("count" => $index, "object" => $list);
}
public function process(){
$path = $this->GetPath();
$tv_objects = $this->GetTVValue($path);
return $tv_objects;
}
}
return 'GetDataMIGxProcessor';