• Модуль: im
  • Путь к файлу: ~/bitrix/modules/im/lib/Configuration/Notification.php
  • Класс: BitrixImConfigurationNotification
  • Вызов: Notification::getDefaultSettings
static function getDefaultSettings(): array
{
	if (!empty(self::$defaultSettings))
	{
		return self::$defaultSettings;
	}

	foreach (EventManager::getInstance()->findEventHandlers("im", "OnGetNotifySchema") as $events)
	{
		$event = ExecuteModuleEventEx($events);

		if (!is_array($event))
		{
			continue;
		}

		foreach ($event as $moduleId => $notifyType)
		{
			self::$defaultSettings[$moduleId]['NAME'] =
				isset($notifyType['NOTIFY'], $notifyType['NAME'])
					? $notifyType['NAME']
					: '';

			$notify = $notifyType['NOTIFY'] ?? $notifyType;

			foreach ($notify as $notifyEvent => $config)
			{
				$config['DISABLED'] = $config['DISABLED'] ?? [];

				if (!isset($config['PUSH']) || $config['PUSH'] === 'NONE')
				{
					$config['DISABLED'][] = self::PUSH;
				}

				$disabled['SITE'] = in_array(self::SITE, $config['DISABLED'], true);
				$disabled['MAIL'] = in_array(self::MAIL, $config['DISABLED'], true);
				$disabled['XMPP'] = in_array(self::XMPP, $config['DISABLED'], true);
				$disabled['PUSH'] = in_array(self::PUSH, $config['DISABLED'], true);

				$config['DISABLED'] = $disabled;

				// backward compatibility
				$config['SITE'] = !isset($config['SITE']) || $config['SITE'] == 'Y';
				$config['MAIL'] = !isset($config['MAIL']) || $config['MAIL'] == 'Y';
				$config['XMPP'] = !isset($config['XMPP']) || $config['XMPP'] == 'Y';
				$config['PUSH'] = isset($config['PUSH']) && $config['PUSH'] == 'Y';

				$config['LIFETIME'] = isset($config['LIFETIME']) ? (int)$config['LIFETIME'] : 0;

				self::$defaultSettings[$moduleId]['NOTIFY'][$notifyEvent] = $config;
			}
		}
	}

	return self::$defaultSettings;
}