• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/integration/rest/eventmanager.php
  • Класс: Bitrix\Crm\Integration\Rest\EventManager
  • Вызов: EventManager::registerDynamicItemsEvents
protected function registerDynamicItemsEvents(array &$bindings): void
{
	// common events
	$eventNames = $this->getDynamicItemCommonEventNames();
	foreach ($eventNames as $eventName)
	{
		$bindings[\CRestUtil::EVENTS][$eventName] = $this->getItemEventInfo($eventName);
	}

	// type specific events
	$typesMap = Service\Container::getInstance()->getDynamicTypesMap()->load([
		'isLoadStages' => false,
		'isLoadCategories' => false,
	]);

	$entityTypeIds = array_map(fn(Type $type) => $type->getEntityTypeId(), $typesMap->getTypes());

	if (Service\Container::getInstance()->getFactory(\CCrmOwnerType::SmartInvoice))
	{
		$entityTypeIds[] = \CCrmOwnerType::SmartInvoice;
	}

	foreach ($entityTypeIds as $entityTypeId)
	{
		foreach ($eventNames as $eventName)
		{
			$typeSpecificEventName = $this->getItemEventNameWithEntityTypeId($eventName, $entityTypeId);
			$bindings[\CRestUtil::EVENTS][$typeSpecificEventName] = $this->getItemEventInfo($typeSpecificEventName);
		}
	}
}