1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
callback.php
См. документацию.
1<?php
8
10
11
15
17{
18 const USER_TYPE_ID_PREFIX = 'rest';
19
20 protected static $descriptionCache = null;
21
22 public static function __callStatic($handlerCode, $arguments)
23 {
24 $userTypeDescription = static::getUserTypeDescription($handlerCode);
25
26 if($userTypeDescription === null)
27 {
28 static::unbindByCode($handlerCode);
29 }
30
31 return $userTypeDescription;
32 }
33
34 public static function bind($fields)
35 {
37
38 $eventManager = EventManager::getInstance();
39 $eventManager->registerEventHandlerCompatible('main', 'OnUserTypeBuildList', 'rest', __CLASS__, static::getUserTypeId($fields));
40
41 $USER_FIELD_MANAGER->CleanCache();
42 static::$descriptionCache = null;
44 }
45
46 public static function unbind($fields)
47 {
48 static::unbindByCode(static::getUserTypeId($fields));
49 }
50
51 public static function unbindByCode($handlerCode)
52 {
54
55 $eventManager = EventManager::getInstance();
56 $eventManager->unRegisterEventHandler('main', 'OnUserTypeBuildList', 'rest', __CLASS__, $handlerCode);
57
58 $USER_FIELD_MANAGER->CleanCache();
59 static::$descriptionCache = null;
61 }
62
63 protected static function getUserTypeDescription($placementHandlerCode)
64 {
65 if(static::$descriptionCache === null)
66 {
67 static::$descriptionCache = array();
68
69 $placementHandlerList = PlacementTable::getHandlersList(UserFieldType::PLACEMENT_UF_TYPE, true);
70 foreach($placementHandlerList as $placementInfo)
71 {
72 static::$descriptionCache[static::getUserTypeId($placementInfo)] = array(
73 'USER_TYPE_ID' => static::getUserTypeId($placementInfo),
74 'CLASS_NAME' => '\Bitrix\Rest\UserField\Type',
75 'DESCRIPTION' => $placementInfo['TITLE'],
76 'BASE_TYPE' => \CUserTypeManager::BASE_TYPE_STRING,
77 'VIEW_CALLBACK' => array('\Bitrix\Rest\UserField\Type', 'getPublicView'),
78 'EDIT_CALLBACK' => array('\Bitrix\Rest\UserField\Type', 'getPublicEdit'),
79 );
80 }
81 }
82
83 return array_key_exists($placementHandlerCode, static::$descriptionCache)
84 ? static::$descriptionCache[$placementHandlerCode]
85 : null;
86 }
87
88 public static function getUserTypeId($userTypeInfo)
89 {
90 return static::USER_TYPE_ID_PREFIX.'_'.$userTypeInfo['APP_ID'].'_'.$userTypeInfo['ADDITIONAL'];
91 }
92}
static clearHandlerCache()
Определения placement.php:380
static getHandlersList($placement, $skipInstallCheck=false, int $userId=null)
Определения placement.php:266
static getUserTypeId($userTypeInfo)
Определения callback.php:88
static unbindByCode($handlerCode)
Определения callback.php:51
static unbind($fields)
Определения callback.php:46
static __callStatic($handlerCode, $arguments)
Определения callback.php:22
const USER_TYPE_ID_PREFIX
Определения callback.php:18
static getUserTypeDescription($placementHandlerCode)
Определения callback.php:63
static bind($fields)
Определения callback.php:34
static $descriptionCache
Определения callback.php:20
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
global $USER_FIELD_MANAGER
Определения attempt.php:6
$eventManager
Определения include.php:412
$fields
Определения yandex_run.php:501