public function prepareCollection($options, $name, Factory\AssetFactory $factory)
{
$assets = isset($options['assets']) ? $options['assets'] : [];
$filters = isset($options['filters']) ? $options['filters'] : [];
$options = isset($options['options']) ? $options['options'] : [];
$options['output'] = isset($options['output']) ? $options['output'] : $name;
$moveRaw = isset($options['move_raw']) && $options['move_raw'];
$targetPath = !empty($options['targetPath']) ? $options['targetPath'] : '';
if (substr($targetPath, -1) != DIRECTORY_SEPARATOR) {
$targetPath .= DIRECTORY_SEPARATOR;
}
$filters = $this->initFilters($filters);
$asset = $factory->createAsset($assets, $filters, $options);
// Allow to move all files 1:1 to new directory
// its particularly useful when this assets are i.e. images.
if ($moveRaw) {
if (isset($options['disable_source_path'])) {
$this->moveRaw($asset, $targetPath, $factory, $options['disable_source_path']);
} else {
$this->moveRaw($asset, $targetPath, $factory);
}
} else {
$asset = $this->cacheAsset($asset);
$this->assetManager->set($name, $asset);
// Save asset on disk
$this->writeAsset($asset, $factory);
}
}