Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
userfield.php
1<?php
2
3namespace Bitrix\Main\Rest;
4
8
10{
11 const EVENT_ON_AFTER_ADD = 'OnAfterUserTypeAdd';
12 const EVENT_ON_AFTER_UPDATE = 'OnAfterUserTypeUpdate';
13 const EVENT_ON_AFTER_DELETE = 'OnAfterUserTypeDelete';
14
18 public static function getHandlers(): array
19 {
20 return (new EventBind(self::class))->getHandlers(static::getBindings());
21 }
22
29 protected static function getBindings(): array
30 {
31 return [
32 self::EVENT_ON_AFTER_ADD => 'main.on.user.type.add',
33 self::EVENT_ON_AFTER_UPDATE => 'main.on.user.type.update',
34 self::EVENT_ON_AFTER_DELETE => 'main.on.user.type.delete',
35 ];
36 }
37
41 public static function getCallbackRestEvent(): array
42 {
43 return [self::class, 'processItemEvent'];
44 }
45
55 public static function processItemEvent(array $arParams, array $arHandler): array
56 {
57 $item = $arParams[0] ?? null;
58 $id = $arParams[1] ?? null;
59
60 $id = $id?:$item['ID'];
61
62 if (!$id)
63 {
64 throw new RestException('id not found trying to process event');
65 }
66
67 return [
68 'FIELDS' => [
69 'ID' => $id
70 ],
71 ];
72 }
73}
static processItemEvent(array $arParams, array $arHandler)
Definition userfield.php:55