- Модуль: documentgenerator
- Путь к файлу: ~/bitrix/modules/documentgenerator/lib/body.php
- Класс: BitrixDocumentGeneratorBody
- Вызов: Body::save
public function save(array $options, Storage $storage = null)
{
$filename = $options['fileName'];
if(!$storage)
{
$storage = $this->storage;
}
if(!$storage)
{
$storage = Driver::getInstance()->getDefaultStorage();
}
$result = $storage->write($this->content, array_merge($options, [
'fileName' => $this->getFileName($filename),
'contentType' => $this->getFileMimeType(),
]));
if($result->isSuccess())
{
$path = $result->getId();
$result = FileTable::add([
'STORAGE_TYPE' => get_class($storage),
'STORAGE_WHERE' => $path,
]);
}
return $result;
}