• Модуль: sender
  • Путь к файлу: ~/bitrix/modules/sender/lib/template.php
  • Класс: BitrixSenderTemplateTable
  • Вызов: TemplateTable::onPresetTemplateList
static function onPresetTemplateList($templateType = null, $templateId = null)
{
	$resultList = array();
	if($templateType && $templateType !== 'USER')
	{
		return $resultList;
	}

	$localPathOfIcon = static::LOCAL_DIR_IMG . 'my.png';
	//$fullPathOfIcon = Loader::getLocal($localPathOfIcon);

	// return only active templates, but if requested template by id return any
	$filter = array();
	if($templateId)
	{
		$filter['ID'] = $templateId;
	}
	else
	{
		$filter['ACTIVE'] = 'Y';
	}

	$templateDb = static::getList(array('filter' => $filter, 'order' => array('ID' => 'DESC')));
	while($template = $templateDb->fetch())
	{
		$resultList[] = array(
			'TYPE' => 'USER',
			'ID' => $template['ID'],
			'NAME' => $template['NAME'],
			'ICON' => '',//(!empty($fullPathOfIcon) ? '/bitrix'.$localPathOfIcon : ''),
			'FIELDS' => array(
				'MESSAGE' => array(
					'CODE' => 'MESSAGE',
					'VALUE' => SecuritySanitizer::fixTemplateStyles($template['CONTENT']),
					'ON_DEMAND' => static::isContentForBlockEditor($template['CONTENT'])
				),
				'SUBJECT' => array(
					'CODE' => 'SUBJECT',
					'VALUE' => $template['NAME'],
				),
			)
		);
	}

	return $resultList;
}