Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
ReactionPopupItem.php
1<?php
2
4
8
10{
11 private ReactionMessages $reactions;
12
16 public function __construct($reactions = null)
17 {
18 $reactions ??= new ReactionMessages([], false);
19
20 if ($reactions instanceof ReactionMessages)
21 {
22 $this->reactions = $reactions;
23 }
24 if ($reactions instanceof ReactionMessage)
25 {
26 $this->reactions = ReactionMessages::initFromArray([$reactions]);
27 }
28 }
29
30 public function merge(PopupDataItem $item): self
31 {
32 if ($item instanceof self)
33 {
34 foreach ($item->reactions as $reaction)
35 {
36 $this->reactions->addReactionMessage($reaction);
37 }
38 }
39
40 return $this;
41 }
42
43 public static function getRestEntityName(): string
44 {
45 return 'reactions';
46 }
47
48 public function toRestFormat(array $option = []): array
49 {
50 return $this->reactions->toRestFormat($option);
51 }
52
53 public function getPopupData(array $excludedList = []): PopupData
54 {
55 return $this->reactions->getPopupData($excludedList);
56 }
57}
static initFromArray(array $reactionArray, bool $withOwnReactions=true)