Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
notifytemplate.php
1<?php
2
4
6{
7 protected const DEFAULT_BORDER_COLOR = '#468EE5';
8
9 protected string $entityTypeName = '';
10 protected string $entityName = '';
11 protected string $entityLink = '';
12
13 public function buildMessage(array $messageFields): array
14 {
15 $attach = new \CIMMessageParamAttach(0, static::DEFAULT_BORDER_COLOR);
16
17 $attach->SetDescription($this->buildDescriptionText());
18
19 $attach->AddDelimiter();
20 $attach->AddMessage('[b]' . $this->entityTypeName . '[/b][br]');
21 $attach->AddLink([
22 'NAME' => $this->entityName,
23 'LINK' => $this->entityLink,
24 ]);
25 $attach->AddDelimiter();
26 $attach->AddMessage($this->buildMessageText());
27
28 $messageFields['ATTACH'] = $attach;
29
30 return $messageFields;
31 }
32
33 public function setFields(array $fields): self
34 {
35 parent::setFields($fields);
36
37 if (is_string($fields['EntityTypeName'] ?? null))
38 {
39 $this->entityTypeName = trim($fields['EntityTypeName']);
40 }
41 if (is_string($fields['EntityName'] ?? null))
42 {
43 $this->entityName = trim($fields['EntityName']);
44 }
45 if (is_string($fields['EntityLink'] ?? null))
46 {
47 $this->entityLink = trim($fields['EntityLink']);
48 }
49
50 return $this;
51 }
52}