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