• Модуль: disk
  • Путь к файлу: ~/bitrix/modules/disk/lib/document/documenthandlersmanager.php
  • Класс: BitrixDiskDocumentDocumentHandlersManager
  • Вызов: DocumentHandlersManager::buildDocumentHandlerList
protected function buildDocumentHandlerList()
{
	$this->documentHandlerList = [];

	if (OnlyOfficeHandler::isEnabled())
	{
		$this->documentHandlerList[OnlyOfficeHandler::getCode()] = OnlyOfficeHandler::class;
	}

	$this->documentHandlerList[BitrixHandler::getCode()] = BitrixHandler::class;
	$this->documentHandlerList[GoogleHandler::getCode()] = GoogleHandler::class;
	$this->documentHandlerList[OneDriveHandler::getCode()] = OneDriveHandler::class;
	$this->documentHandlerList[Office365Handler::getCode()] = Office365Handler::class;
	$this->documentHandlerList[DropboxHandler::getCode()] = DropboxHandler::class;
	$this->documentHandlerList[GoogleViewerHandler::getCode()] = GoogleViewerHandler::class;
	$this->documentHandlerList[YandexDiskHandler::getCode()] = YandexDiskHandler::class;
	$this->documentHandlerList[BoxHandler::getCode()] = BoxHandler::class;

	if (MyOfficeHandler::isEnabled() && MyOfficeHandler::getPredefinedUser($this->userId))
	{
		$this->documentHandlerList[MyOfficeHandler::getCode()] = MyOfficeHandler::class;
	}

	$event = new Event(Driver::INTERNAL_MODULE_ID, 'onDocumentHandlerBuildList');
	$event->send();
	if($event->getResults())
	{
		foreach($event->getResults() as $evenResult)
		{
			if($evenResult->getType() != EventResult::SUCCESS)
			{
				continue;
			}
			$result = $evenResult->getParameters();
			if(!is_array($result))
			{
				throw new SystemException('Wrong event result by building DocumentHandlerList. Must be array.');
			}
			if(empty($result['CODE_NAME']))
			{
				throw new SystemException('Wrong event result by building DocumentHandlerList. Could not find CODE_NAME.');
			}
			if(empty($result['CLASS']))
			{
				throw new SystemException('Wrong event result by building DocumentHandlerList. Could not find CLASS.');
			}
			if(is_string($result['CLASS']) && class_exists($result['CLASS']))
			{
				$this->documentHandlerList[$result['CODE_NAME']] = $result['CLASS'];
			}
			else
			{
				throw new SystemException('Wrong event result by building DocumentHandlerList. Could not find class by CLASS.');
			}
		}
	}
}