• Модуль: imconnector
  • Путь к файлу: ~/bitrix/modules/imconnector/lib/Tools/Connectors/Notifications.php
  • Класс: BitrixImConnectorToolsConnectorsNotifications
  • Вызов: Notifications::detectActiveLineByButton
static function detectActiveLineByButton(): ?int
{
	if (!Loader::includeModule('crm'))
	{
		return null;
	}

	$preInstalledButtonData = SiteButtonInternalsButtonTable::getRow([
		'select' => ['ID', 'ITEMS'],
		'filter' => [
			'=IS_SYSTEM' => 'Y',
			'=ACTIVE' => 'Y'
		]
	]);

	if (!$preInstalledButtonData)
	{
		return null;
	}

	$preInstalledButton = new SiteButtonButton();
	$preInstalledButton->loadByData($preInstalledButtonData);
	$openLine = $preInstalledButton->getOpenLine();
	if ($openLine && isset($openLine['EXTERNAL_ID']) && $openLine['EXTERNAL_ID'] > 0)
	{
		return (int)$openLine['EXTERNAL_ID'];
	}

	return null;
}