1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
ChannelAndChatDataFilter.php
См. документацию.
1<?php
3
9
16{
24 public function __construct(array $options = [])
25 {
26 parent::__construct();
27
28 if (isset($options['tabId']) && is_string($options['tabId']))
29 {
30 $this->options['tabId'] = $options['tabId'];
31 }
32
33 $this->options['includeSubtitle'] = $options['includeSubtitle'] ?? true;
34 }
35
36 public function isAvailable(): bool
37 {
38 return $GLOBALS['USER']->isAuthorized();
39 }
40
41 public function apply(array $items, Dialog $dialog): void
42 {
43 if ($this->options['includeSubtitle'])
44 {
45 foreach ($items as $item)
46 {
47 $chat = $item->getCustomData()->get('chat');
48 $subtitle = match ($chat['messageType'] ?? null) {
49 'C', 'O' => Loc::getMessage('IM_ENTITY_SELECTOR_CHAT_SUBTITLE_TYPE_CHAT'),
50 'J' => Loc::getMessage('IM_ENTITY_SELECTOR_CHAT_SUBTITLE_TYPE_OPEN_CHANNEL'),
51 'N' => Loc::getMessage('IM_ENTITY_SELECTOR_CHAT_SUBTITLE_TYPE_CLOSED_CHANNEL'),
52 default => '',
53 };
54 $item->setSubtitle($subtitle);
55 }
56 }
57
58 foreach ($items as $item)
59 {
60 if (!($item instanceof Item))
61 {
62 continue;
63 }
64
65 // allow default avatar if empty
66 if ($item->getAvatar() === '')
67 {
68 $item->setAvatar(null);
69 }
70
71 if (isset($this->options['tabId']))
72 {
73 $item->addTab($this->options['tabId']);
74 }
75 }
76 }
77}
Определения dialog.php:11
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$GLOBALS['____1690880296']
Определения license.php:1
$items
Определения template.php:224