- Модуль: sender
- Путь к файлу: ~/bitrix/modules/sender/lib/message/adapter.php
- Класс: BitrixSenderMessageAdapter
- Вызов: Adapter::preHandleReaplaceValue
public function preHandleReaplaceValue($code, $value)
{
$parts = explode('.', $code, 2);
if (count($parts) === 1)
{
return $value;
}
$entityId = $parts[1];
if (!self::$statuses)
{
$refClass = new ReflectionClass(BitrixCrmStatusTable::class);
$refConstants = $refClass->getConstants();
if (is_iterable($refConstants))
{
foreach ($refConstants as $key => $refConstant)
{
if (mb_strpos($key, self::PATTERN_STATUS_ITEM) !== false)
{
self::$statuses[] = $refConstant;
}
}
}
}
if (!in_array($entityId, self::$statuses, true))
{
return $value;
}
$values = BitrixCrmStatusTable::getStatusesList($entityId);
if (array_key_exists($value, $values))
{
return $values[$value];
}
return $value;
}