- Модуль: sender
- Путь к файлу: ~/bitrix/modules/sender/lib/preset/mailblockbase.php
- Класс: BitrixSenderPresetMailBlockBase
- Вызов: MailBlockBase::getById
static function getById($blockName)
{
$result = null;
$type = null;
$arBlockByType = static::getBlockListByType();
foreach($arBlockByType as $searchType => $arBlock)
{
foreach ($arBlock as $searchBlockName)
{
if($blockName == $searchBlockName)
{
$type = $searchType;
break;
}
}
}
$fullPathOfFile = BitrixMainLoader::getLocal(static::LOCAL_DIR_BLOCK . bx_basename($blockName) . '.html');
if ($fullPathOfFile)
{
$fileContent = File::getFileContents($fullPathOfFile);
if($blockName == 'unsub')
{
$fileContent = str_replace(
array('%TEXT_UNSUB_TEXT%', '%TEXT_UNSUB_LINK%'),
array(
Loc::getMessage('PRESET_MAILBLOCK_' . $blockName.'_TEXT_UNSUB_TEXT'),
Loc::getMessage('PRESET_MAILBLOCK_' . $blockName.'_TEXT_UNSUB_LINK')
),
$fileContent
);
}
$result = array(
'TYPE' => Loc::getMessage('TYPE_PRESET_MAILBLOCK_'.$type),
'CODE' => $blockName,
'NAME' => Loc::getMessage('PRESET_MAILBLOCK_' . $blockName),
'ICON' => '',
'HTML' => $fileContent
);
}
return $result;
}