Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
entitycreated.php
1<?php
2
4
8
9class EntityCreated extends Base
10{
11 const TYPE = 'CREATEENTITY';
12
13 public function getType(): string
14 {
15 return static::TYPE;
16 }
17
18 public function getText(string $text = '', array $params = []): string
19 {
20 $result = '';
21
22 try
23 {
24 $data = Json::decode($text);
25 }
26 catch(\Bitrix\Main\ArgumentException $e)
27 {
28 $data = [];
29 }
30
31 if (
32 !is_array($data)
33 || empty($data)
34 || !Loader::includeModule('socialnetwork')
35 )
36 {
37 return $result;
38 }
39
40 $options = [];
41 if (isset($params['suffix']))
42 {
43 $options['suffix'] = $params['suffix'];
44 }
45
46 $socNetProvider = CommentAux\Base::init($this->getSocnetType(), $data, $options);
47 $result = $socNetProvider->getText();
48
49 return $result;
50 }
51
52 public function canDelete(): bool
53 {
54 return false;
55 }
56
57 protected function getSocnetType(): string
58 {
59 return CommentAux\CreateEntity::TYPE;
60 }
61}
getText(string $text='', array $params=[])