• Модуль: disk
  • Путь к файлу: ~/bitrix/modules/disk/lib/document/onlyoffice/editor/configbuilder.php
  • Класс: BitrixDiskDocumentOnlyOfficeEditorConfigBuilder
  • Вызов: ConfigBuilder::build
public function build(): array
{
	$baseUrl = new Uri(UrlManager::getInstance()->getHostUrl());

	$editorOptions = [
		'_version' => self::VERSION,
		'documentType' => $this->getDocumentType(),
		'document' => [
			'fileType' => $this->fileExtension,
			'key' => $this->documentSession->getExternalHash(),
			'title' => $this->documentSession->getFilename(),
			'url' => (string)$this->documentUrl,
			'owner' => '',
			'uploaded' => '',
			'permissions' => [
				'chat' => false,
				'print' => $this->supportPrint(),
				'download' => $this->permissions['download'] ?? true,
				'copy' => true,
				'edit' => $this->permissions['edit'] ?? false,
				'rename' => $this->permissions['rename'] ?? false,
				'review' => true,
				'comment' => true,
			],
		],
		'editorConfig' => [
			'user' => [
				'id' => (string)$this->user->getId(),
				'name' => $this->user->getFormattedName(),
			],
			'lang' => $this->getLangCode(),
			'region' => $this->getRegion(),
			'mode' => $this->mode,
			'coEditing' => [
				'mode' => $this->isViewMode() ? 'strict' : 'fast',
				'change' => false,
			],
			'callbackUrl' => (string)$this->callbackUrl,
			'customization' => $this->getCustomizationSection($baseUrl),
		],
		'events' => [],
	];

	if (!Application::getInstance()->isUtfMode())
	{
		$editorOptions['token'] = JWT::encode(
			Encoding::convertEncoding($editorOptions, SITE_CHARSET, 'UTF-8'),
			$this->getSecretKey()
		);
	}
	else
	{
		$editorOptions['token'] = JWT::encode($editorOptions, $this->getSecretKey());
	}

	return $editorOptions;
}