• Модуль: disk
  • Путь к файлу: ~/bitrix/modules/disk/lib/controller/onlyoffice.php
  • Класс: BitrixDiskControllerOnlyOffice
  • Вызов: OnlyOffice::continueWithNewSessionAction
public function continueWithNewSessionAction(ModelsDocumentSession $session, bool $force = false): ?array
{
	$documentInfo = $session->getInfo();
	if (!$documentInfo)
	{
		$this->addError(new Error("Session {$session->getId()} doesn't have info."));

		return null;
	}

	if (!$force && !$documentInfo->isFinished())
	{
		$this->addError(new Error("Session {$session->getId()} in status {$documentInfo->getContentStatus()}"));

		return null;
	}

	$newSession = $session->cloneWithNewHash($session->getUserId());
	if (!$newSession)
	{
		$this->addErrors($session->getErrors());

		return null;
	}

	/** @see DiskFileEditorOnlyOfficeController::getSliderContentAction */
	$link = UrlManager::getInstance()->create('getSliderContent', [
		'c' => 'bitrix:disk.file.editor-onlyoffice',
		'mode' => Router::COMPONENT_MODE_AJAX,
		'documentSessionId' => $newSession->getId(),
		'documentSessionHash' => $newSession->getExternalHash(),
	]);

	return [
		'documentSession' => [
			'id' => $newSession->getId(),
			'hash' => $newSession->getExternalHash(),
			'link' => $link,
		],
	];
}