• Модуль: disk
  • Путь к файлу: ~/bitrix/modules/disk/lib/volume/module/iblock.php
  • Класс: BitrixDiskVolumeModuleIblock
  • Вызов: Iblock::getEntityList
public function getEntityList(): array
{
	static $entityList;
	if (!isset($entityList))
	{
		$entityList = [];

		$excludeIblockIds = [];

		// Exclude webdav iblocks
		$webdav = new VolumeModuleWebdav();
		$webdavIblockList = $webdav->getIblockList();
		if (count($webdavIblockList) > 0)
		{
			foreach ($webdavIblockList as $iblock)
			{
				$excludeIblockIds[] = $iblock['ID'];
			}
		}

		$filter = $this->getFilter(['!@IBLOCK_ID' => $excludeIblockIds]);

		$excludeIblockIds = [];
		if (isset($filter['!@IBLOCK_ID']))
		{
			$excludeIblockIds = $filter['!@IBLOCK_ID'];
		}
		elseif (isset($filter['!IBLOCK_ID']))
		{
			$excludeIblockIds[] = $filter['IBLOCK_ID'];
		}

		$includeIblockIds = [];
		if (isset($filter['@IBLOCK_ID']))
		{
			$includeIblockIds = $filter['@IBLOCK_ID'];
		}
		elseif (isset($filter['IBLOCK_ID']))
		{
			$includeIblockIds[] = $filter['IBLOCK_ID'];
		}
		elseif (isset($filter['=IBLOCK_ID']))
		{
			$includeIblockIds[] = $filter['@IBLOCK_ID'];
		}


		// Exclude iblocks
		$excludeEntityIds = [];
		foreach ($excludeIblockIds as $iblockId)
		{
			$excludeEntityIds[] = 'IBLOCK_'.$iblockId;
			$excludeEntityIds[] = 'IBLOCK_'.$iblockId.'_SECTION';
		}

		// include iblocks
		$includeEntityIds = [];
		foreach ($includeIblockIds as $iblockId)
		{
			$includeEntityIds[] = 'IBLOCK_'.$iblockId;
			$includeEntityIds[] = 'IBLOCK_'.$iblockId.'_SECTION';
		}

		$filter = [
			'ENTITY_ID'     => 'IBLOCK_%',
			'=USER_TYPE_ID' => [
				CUserTypeFile::USER_TYPE_ID,
				DiskUfFileUserType::USER_TYPE_ID,
				DiskUfVersionUserType::USER_TYPE_ID,
			],
		];
		$userFieldList = BitrixMainUserFieldTable::getList(['filter' => $filter]);
		if ($userFieldList->getSelectedRowsCount() > 0)
		{
			foreach ($userFieldList as $userField)
			{
				$entityName = $userField['ENTITY_ID'];
				if (isset($entityList[$entityName]))
				{
					continue;
				}

				// exclude
				if (count($excludeIblockIds) > 0 && in_array($entityName, $excludeIblockIds)) continue;
				// include
				if (count($includeEntityIds) > 0 && !in_array($entityName, $includeEntityIds)) continue;

				/** @var BitrixMainEntityBase $ent */
				$ent = BitrixMainEntityBase::compileEntity($entityName, [], [
					'namespace' => __NAMESPACE__,
					'uf_id'     => $entityName,
				]);

				$entityList[$entityName] = $ent->getDataClass();
			}
		}
	}

	return $entityList;
}