• Модуль: intranet
  • Путь к файлу: ~/bitrix/modules/intranet/lib/controller/controlbutton.php
  • Класс: BitrixIntranetControllerControlButton
  • Вызов: ControlButton::getChatAction
public function getChatAction($entityType, $entityId, $entityData = [])
{
	if (!$entityType || !$entityId)
	{
		$this->addError(new Error(Loc::getMessage('INTRANET_CONTROL_BUTTON_ENTITY_ERROR')));
		return null;
	}

	if (!Loader::includeModule('im'))
	{
		$this->addError(new Error(Loc::getMessage('INTRANET_CONTROL_BUTTON_IM_ERROR'), 'create_chat_error'));
		return null;
	}

	$chatId = '';

	if ($entityType === 'task')
	{
		$chatId = $this->getTaskChat($entityId);
	}
	elseif ($entityType === 'calendar_event')
	{
		$chatId = $this->getCalendarChat($entityId, $entityData);
	}
	elseif ($entityType === 'workgroup')
	{
		$chatId = $this->getWorkgroupChat($entityId, $entityData);
	}

	return $chatId;
}