Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
userfield.php
1
<?php
2
3
namespace
Bitrix\Main\Rest
;
4
5
use
Bitrix\Rest\Event\EventBind
;
6
use
Bitrix\Rest\Event\EventBindInterface
;
7
use
Bitrix\Rest\RestException
;
8
9
class
UserField
implements
EventBindInterface
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
}
Bitrix\Main\Rest\UserField
Definition
userfield.php:10
Bitrix\Main\Rest\UserField\getCallbackRestEvent
static getCallbackRestEvent()
Definition
userfield.php:41
Bitrix\Main\Rest\UserField\EVENT_ON_AFTER_ADD
const EVENT_ON_AFTER_ADD
Definition
userfield.php:11
Bitrix\Main\Rest\UserField\getHandlers
static getHandlers()
Definition
userfield.php:18
Bitrix\Main\Rest\UserField\getBindings
static getBindings()
Definition
userfield.php:29
Bitrix\Main\Rest\UserField\EVENT_ON_AFTER_UPDATE
const EVENT_ON_AFTER_UPDATE
Definition
userfield.php:12
Bitrix\Main\Rest\UserField\EVENT_ON_AFTER_DELETE
const EVENT_ON_AFTER_DELETE
Definition
userfield.php:13
Bitrix\Main\Rest\UserField\processItemEvent
static processItemEvent(array $arParams, array $arHandler)
Definition
userfield.php:55
Bitrix\Rest\Event\EventBind
Definition
eventbind.php:12
Bitrix\Rest\RestException
Definition
restexception.php:6
Bitrix\Rest\Event\EventBindInterface
Definition
eventbindinterface.php:12
Bitrix\Main\Rest
Definition
handlers.php:8
modules
main
lib
rest
userfield.php
Создано системой
1.10.0