• Модуль: im
  • Путь к файлу: ~/bitrix/modules/im/lib/V2/Settings/Entity/Notify.php
  • Класс: BitrixImV2SettingsEntityNotify
  • Вызов: Notify::toRestFormat
public function toRestFormat(array $option = []): array
{
	if (!$this->isLoad())
	{
		$this->load($this->groupId);
	}

	$notifyNames = Notification::getEventNames();
	$result = [];
	foreach ($this->settings as $moduleId => $moduleConfig)
	{
		$newModuleConfig = [
			'id' => $moduleId,
			'label' => $notifyNames[$moduleId]['NAME'],
			'notices' => [],
		];

		$notices = [];
		foreach ($moduleConfig['NOTIFY'] as $eventName => $eventConfig)
		{
			$notify = [
				'id' => $eventName,
				'label' => $eventConfig['NAME'],
				'site' => $eventConfig['SITE'],
				'mail' => $eventConfig['MAIL'],
				'push' => $eventConfig['PUSH'],
				'disabled' => [],
			];

			$disabled = [];
			foreach ($eventConfig['DISABLED'] as $disableType => $value)
			{
				if ($disableType === 'XMPP')
				{
					continue;
				}
				if ($value)
				{
					$disabled[] = mb_strtolower($disableType);
				}
			}
			$notify['disabled'] = $disabled;

			$notices[] = $notify;
		}
		$newModuleConfig['notices'] = $notices;
		$result[] = $newModuleConfig;
	}

	return $result;
}