• Модуль: sender
  • Путь к файлу: ~/bitrix/modules/sender/lib/integration/sender/mail/messagemail.php
  • Класс: Bitrix\Sender\Integration\Sender\Mail\MessageMail
  • Вызов: MessageMail::setConfigurationOptions
protected function setConfigurationOptions()
{
	if ($this->configuration->hasOptions())
	{
		return;
	}

	$this->configuration->setArrayOptions(array(
		array(
			'type' => 'string',
			'code' => 'SUBJECT',
			'name' => Loc::getMessage('SENDER_INTEGRATION_MAIL_MESSAGE_CONFIG_SUBJECT'),
			'required' => true,
			'value' => '',
			'show_in_list' => true,
			'hint' => array(
				'menu' => array_map(
					function ($item)
					{
						return array(
							'id' => '#' . ($item['CODE'] ?? '') . '#',
							'text' => $item['NAME'] ?? '',
							'title' => $item['DESC'] ?? '',
							'items' => isset($item['ITEMS']) ? array_map(
								function ($item)
								{
									return array(
										'id' => '#' . ($item['CODE'] ?? ''). '#',
										'text' => $item['NAME'] ?? '',
										'title' => $item['DESC'] ?? ''
									);
								}, $item['ITEMS']
							) : []
						);
					},
					array_merge(
						Helper::getPersonalizeFieldsFromConnectors(),
						PostingRecipientTable::getPersonalizeList()
					)
				),
			),
		),
		array(
			'type' => 'email',
			'code' => 'EMAIL_FROM',
			'name' => Loc::getMessage('SENDER_INTEGRATION_MAIL_MESSAGE_CONFIG_EMAIL_FROM'),
			'required' => true,
			'value' => '',
			'show_in_list' => true,
			'readonly_view' => function($value)
			{
				return (new Mail\Address())->set($value)->get();
			},
			//'group' => Message\ConfigurationOption::GROUP_ADDITIONAL,
		),
		array(
			'type' => 'mail-editor',
			'code' => 'MESSAGE',
			'name' => Loc::getMessage('SENDER_INTEGRATION_MAIL_MESSAGE_CONFIG_MESSAGE'),
			'required' => true,
			'templated' => true,
			'value' => '',
			'items' => array(),
		),
		array(
			'type' => 'list',
			'code' => 'PRIORITY',
			'name' => Loc::getMessage('SENDER_INTEGRATION_MAIL_MESSAGE_CONFIG_PRIORITY'),
			'required' => false,
			'group' => Message\ConfigurationOption::GROUP_ADDITIONAL,
			'value' => '',
			'show_in_list' => true,
			'items' => array(
				array('code' => '', 'value' => '(' . Loc::getMessage('SENDER_INTEGRATION_MAIL_MESSAGE_NO') . ')'),
				array('code' => '1 (Highest)', 'value' => Loc::getMessage('SENDER_INTEGRATION_MAIL_MESSAGE_CONFIG_PRIORITY_HIGHEST')),
				array('code' => '3 (Normal)', 'value'  => Loc::getMessage('SENDER_INTEGRATION_MAIL_MESSAGE_CONFIG_PRIORITY_NORMAL')),
				array('code' => '5 (Lowest)', 'value'  => Loc::getMessage('SENDER_INTEGRATION_MAIL_MESSAGE_CONFIG_PRIORITY_LOWEST')),
			),
			'hint' => Loc::getMessage('SENDER_INTEGRATION_MAIL_MESSAGE_CONFIG_PRIORITY_HINT'),
		),
		array(
			'type' => 'string',
			'code' => 'LINK_PARAMS',
			'name' => Loc::getMessage('SENDER_INTEGRATION_MAIL_MESSAGE_CONFIG_LINK_PARAMS'),
			'required' => false,
			'group' => Message\ConfigurationOption::GROUP_ADDITIONAL,
			'value' => '',
			'show_in_list' => true,
			'items' => array(),
		),
		array(
			'type' => 'file',
			'code' => 'ATTACHMENT',
			'name' => Loc::getMessage('SENDER_INTEGRATION_MAIL_MESSAGE_CONFIG_ATTACHMENT'),
			'required' => false,
			'multiple' => true,
			'group' => Message\ConfigurationOption::GROUP_ADDITIONAL,
			'value' => '',
			'items' => array(),
		), [
			'type' => Message\ConfigurationOption::TYPE_CHECKBOX,
			'code' => 'TRACK_MAIL',
			'name' => Loc::getMessage('SENDER_INTEGRATION_MAIL_MESSAGE_CONFIG_TRACK_MAIL'),
			'hint' => Loc::getMessage('SENDER_INTEGRATION_MAIL_MESSAGE_CONFIG_TRACK_MAIL_HINT'),
			'group' => Message\ConfigurationOption::GROUP_ADDITIONAL,
			'show_in_list' => false,
			'required' => false,
			'value' => Option::get('sender', 'track_mails')
		],
		[
			'type' => Message\ConfigurationOption::TYPE_CONSENT,
			'code' => 'APPROVE_CONFIRMATION',
			'name' => Loc::getMessage('SENDER_INTEGRATION_MAIL_MESSAGE_CONFIG_APPROVE_CONFIRMATION'),
			'hint' => Loc::getMessage('SENDER_INTEGRATION_MAIL_MESSAGE_CONFIG_APPROVE_CONFIRMATION_HINT'),
			'group' => Message\ConfigurationOption::GROUP_ADDITIONAL,
			'show_in_list' => false,
			'required' => false,
			'value' => Option::get('sender', 'mail_consent'),
		], [
			'type' => Message\ConfigurationOption::TYPE_CONSENT_CONTENT,
			'code' => 'APPROVE_CONFIRMATION_CONSENT',
			'group' => Message\ConfigurationOption::GROUP_ADDITIONAL,
			'show_in_list' => false,
			'required' => false,
			'show_preview' => true
		],
	));

	TimeLimiter::prepareMessageConfiguration($this->configuration);

	$list = array(
		array(
			'type' => 'template-type',
			'code' => 'TEMPLATE_TYPE',
			'name' => 'Template type',
			'value' => '',
		),
		array(
			'type' => 'template-id',
			'code' => 'TEMPLATE_ID',
			'name' => 'Template id',
			'value' => '',
		),
	);

	foreach ($list as $optionData)
	{
		$optionData = $optionData + array(
			'type' => 'string',
			'name' => '',
			'internal' => true,
		);
		$this->configuration->addOption(new Message\ConfigurationOption($optionData));
	}
}