• Модуль: disk
  • Путь к файлу: ~/bitrix/modules/disk/lib/uf/controller.php
  • Класс: BitrixDiskUfController
  • Вызов: Controller::searchObjects
private function searchObjects($entityType, $entityId, $searchQuery, $limit = 40)
{
	if($entityType === 'recently_used')
	{
		$recentlyUsedManager = Driver::getInstance()->getRecentlyUsedManager();
		return $recentlyUsedManager->getFileModelListByUser($this->getUser(), array('%NAME' => $searchQuery));
	}
	if($entityType === 'storage')
	{
		$storage = $this->getStorageByType(
			$this->request->getPost('storageType'),
			$this->request->getPost('storageId')
		);

		if(!$storage)
		{
			$this->errorCollection[] = new Error('Could not find storage');
			return null;
		}

		$currentFolderId = Driver::getInstance()->getUrlManager()->resolveFolderIdFromPath($storage, $entityId);
		/** @var Folder $folder */
		$folder = Folder::loadById($currentFolderId);
		if(!$folder)
		{
			$this->errorCollection->add(array(new Error('Could not find folder by path')));
			return null;
		}
		$securityContext = $folder->getStorage()->getCurrentUserSecurityContext();

		return $folder->getDescendants($securityContext, array(
			'with' => array('UPDATE_USER'),
			'filter' => array('%NAME' => $searchQuery),
			'limit' => $limit
		));
	}
	if($entityType === 'all')
	{
		return array();
	}
	$this->errorCollection->add(array(new Error("Could not parse entity type {$entityType}")));

	return null;
}