1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
baseevent.php
См. документацию.
1<?php
2
4
10
11abstract class BaseEvent
12{
13 protected static array $subscribers = [];
14
18 public function emit(): array
19 {
20 foreach ($this->getSubscribers() as $subscriber)
21 {
22 self::$subscribers[$this::getEventType()] ??= [];
23
24 if (!empty(self::$subscribers[$this::getEventType()][$subscriber::class]))
25 {
26 continue;
27 }
28
29 ServiceLocator::getInstance()->get(EventManagerInterface::class)->addEventHandler(
30 fromModuleId: $this::getModuleId(),
31 eventType: $this::getEventType(),
32 callback: $subscriber,
33 );
34
35 self::$subscribers[$this::getEventType()][$subscriber::class] = $subscriber::class;
36 }
37
38 return $this->send($this->buildEvent());
39 }
40
41 protected function send(Event $event): array
42 {
44 $eventManager = ServiceLocator::getInstance()->get(EventManagerInterface::class);
45 $eventManager->send($event);
46
47 return $event->getResults();
48 }
49
50 protected function buildEvent(): Event
51 {
52 return new Event($this::getModuleId(), $this::getEventType(), $this->getEventParams());
53 }
54
55 public static function getModuleId(): string
56 {
57 return Common::CALENDAR_MODULE_ID;
58 }
59
60 abstract public static function getEventType(): string;
61
62 abstract protected function getEventParams(): array;
63
67 protected function getSubscribers(): array
68 {
69 return [];
70 }
71}
Определения event.php:5
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$event
Определения prolog_after.php:141
$eventManager
Определения include.php:412
case callback
Определения wrapper_popup.php:31