CCrmRestEventDispatcher::sendEvent

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CCrmRestEventDispatcher
  4. sendEvent
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/restservice.php
  • Класс: \CCrmRestEventDispatcher
  • Вызов: CCrmRestEventDispatcher::sendEvent
static function sendEvent($action, $params, $options)
{
	if (is_array($options) && isset($options['UF_ENTITY_ID']))
	{
		$ufEntityId = $options['UF_ENTITY_ID'];
		if (is_string($ufEntityId) && $ufEntityId !== '')
		{
			$entityTypeId = static::getOwnerTypeIdByEntityId($ufEntityId);
			if (\CCrmOwnerType::isUseDynamicTypeBasedApproach($entityTypeId))
			{
				$eventName = 'onCrmTypeUserField' . $action;
			}
			else
			{
				$entityName = static::getOwnerTypeNameByEntityId($ufEntityId);
				$entityName = ucfirst(mb_strtolower($entityName));
				$eventName = 'OnAfterCrmRest' . $entityName . 'UserField' . $action;
			}
			$event = new Main\Event(
				'crm',
				$eventName,
				$params
			);
			$event->send();
		}
	}
}

Добавить комментарий