1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
eventdispatcher.php
См. документацию.
1<?php
2
4
7
9{
10 public const PLACEMENT_EXTERNAL_PRODUCT = 'CATALOG_EXTERNAL_PRODUCT';
11 const SCOPE_CATALOG = 'catalog';
12 const MODULE_ID = 'catalog';
13
21 public static function onRestServiceBuildDescription(): array
22 {
23 return (new EventDispatcher())->dispatch();
24 }
25
33 public function dispatch(): array
34 {
35 $bindings = [];
36 $classes = $this->collectEntityEventBind();
37
38 foreach ($classes as $class)
39 {
40 $reflection = new \ReflectionClass($class);
41 if (
42 !$reflection->isInterface()
43 && !$reflection->isAbstract()
44 && !$reflection->isTrait())
45 {
46 if ($reflection->implementsInterface('\\Bitrix\\Rest\\Event\\EventBindInterface'))
47 {
48 $bindings += $this->getBindings($class);
49 }
50 }
51 }
52 return [
53 self::SCOPE_CATALOG => [
54 \CRestUtil::EVENTS => $bindings,
55 \CRestUtil::PLACEMENTS => [
56 self::PLACEMENT_EXTERNAL_PRODUCT => [],
57 ],
58 ]
59 ];
60 }
61
62 protected function collectEntityEventBind(): array
63 {
64 $controllersConfig = Configuration::getInstance(self::MODULE_ID);
65
66 if (!$controllersConfig['controllers'] || !$controllersConfig['controllers']['restIntegration'] || !$controllersConfig['controllers']['restIntegration']['eventBind'])
67 {
68 return [];
69 }
70
71 return $controllersConfig['controllers']['restIntegration']['eventBind'];
72 }
73
81 public function getBindings(string $class): array
82 {
83 return $class::getHandlers();
84 }
85}
static getInstance($moduleId=null)
Определения configuration.php:45
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804