• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/counter/entitycounterfactory.php
  • Класс: Bitrix\Crm\Counter\EntityCounterFactory
  • Вызов: EntityCounterFactory::createCustomSectionCounter
static function createCustomSectionCounter(string $code, int $userID): AggregateCounter
{
	$settings = CustomSectionProvider::getPagesSettingsByCustomSectionCounterId($code);
	$data = [];
	foreach ($settings as $setting)
	{
		$entityTypeID = CustomSectionProvider::getEntityTypeByPageSetting($setting);

		if(!\CCrmOwnerType::IsDefined($entityTypeID))
		{
			continue;
		}

		$data[] = [
			'entityTypeID' => CustomSectionProvider::getEntityTypeByPageSetting($setting),
			'counterTypeID' => EntityCounterType::ALL,
		];
	}

	return new AggregateCounter($code, $data, $userID);
}