Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
consentinstaller.php
1<?php
2
4
5
9Loc::loadMessages(__FILE__);
10
12{
13 public static function run(string $lang): string
14 {
15 self::createConsent('sender_approve_confirmation_', $lang);
16
17 return '';
18 }
19
20 private static function createConsent(string $code, string $lang)
21 {
22 $preparedCode = $code.$lang;
23 $existed = AgreementTable::getList(array(
24 'select' => ['ID'],
25 'filter' => [
26 '=CODE' => $preparedCode,
27 '=LANGUAGE_ID' => $lang,
28 ],
29 'limit' => 1
30 ));
31
32
33 if ($existed->fetch())
34 {
35 return '';
36 }
37
38 $title = Loc::getMessage($code.'title', null, $lang);
39 if (!$title)
40 {
41 return '\\Bitrix\\Sender\\Preset\\Consent\\ConsentInstaller::run(\''.$lang.'\')';
42 }
43
44 AgreementTable::add(array(
45 "CODE" => $preparedCode,
46 "NAME" => $title,
47 "TYPE" => Agreement::TYPE_CUSTOM,
48 "LANGUAGE_ID" => $lang,
49 "AGREEMENT_TEXT" => Loc::getMessage($code . 'text',null, $lang),
50 "LABEL_TEXT" => Loc::getMessage($code . 'label', null, $lang),
51 ));
52 }
53}
static loadMessages($file)
Definition loc.php:64
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29