Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
Placement.php
1<?php
2
4
6{
7 public const IM_CONTEXT_MENU = 'IM_CONTEXT_MENU';
8 public const IM_NAVIGATION = 'IM_NAVIGATION';
9 public const IM_TEXTAREA = 'IM_TEXTAREA';
10 public const IM_SIDEBAR = 'IM_SIDEBAR';
11 public const IM_SMILES_SELECTOR = 'IM_SMILES_SELECTOR';
12
13 public static function getPlacementList(): array
14 {
15 return [
21 ];
22 }
23
28 public static function onRestServiceBuildDescription(): array
29 {
30 return [
31 \CRestUtil::GLOBAL_SCOPE => [
32 \CRestUtil::PLACEMENTS => [
33 self::IM_CONTEXT_MENU => [
34 'options' => [
35 'extranet' => [
36 'type' => 'string',
37 'default' => 'N',
38 'require' => false,
39 ],
40 'context' => [
41 'type' => 'string',
42 'default' => 'ALL',
43 'require' => false,
44 ],
45 'role' => [
46 'type' => 'string',
47 'default' => 'USER',
48 'require' => false,
49 ],
50 ],
51 'registerCallback' => [
52 'moduleId' => 'im',
53 'callback' => [self::class, 'onRegisterPlacementContextMenu'],
54 ],
55 ],
56 self::IM_NAVIGATION => [
57 'options' => [
58 'iconName' => [
59 'type' => 'string',
60 'require' => true,
61 ],
62 'extranet' => [
63 'type' => 'string',
64 'default' => 'N',
65 'require' => false,
66 ],
67 'role' => [
68 'type' => 'string',
69 'default' => 'USER',
70 'require' => false,
71 ],
72 ],
73 'registerCallback' => [
74 'moduleId' => 'im',
75 'callback' => [self::class, 'onRegisterPlacementNavigation'],
76 ],
77 ],
78 self::IM_TEXTAREA => [
79 'options' => [
80 'iconName' => [
81 'type' => 'string',
82 'require' => true,
83 ],
84 'extranet' => [
85 'type' => 'string',
86 'default' => 'N',
87 'require' => false,
88 ],
89 'context' => [
90 'type' => 'string',
91 'default' => 'ALL',
92 'require' => false,
93 ],
94 'role' => [
95 'type' => 'string',
96 'default' => 'USER',
97 'require' => false,
98 ],
99 'color' => [
100 'type' => 'string',
101 'require' => false,
102 ],
103 'width' => [
104 'type' => 'int',
105 'default' => 100,
106 'require' => false,
107 ],
108 'height' => [
109 'type' => 'int',
110 'default' => 100,
111 'require' => false,
112 ]
113 ],
114 'registerCallback' => [
115 'moduleId' => 'im',
116 'callback' => [self::class, 'onRegisterPlacementTextArea'],
117 ],
118 ],
119 self::IM_SIDEBAR => [
120 'options' => [
121 'iconName' => [
122 'type' => 'string',
123 'require' => true,
124 ],
125 'extranet' => [
126 'type' => 'string',
127 'default' => 'N',
128 'require' => false,
129 ],
130 'context' => [
131 'type' => 'string',
132 'default' => 'ALL',
133 'require' => false,
134 ],
135 'role' => [
136 'type' => 'string',
137 'default' => 'USER',
138 'require' => false,
139 ],
140 'color' => [
141 'type' => 'string',
142 'require' => false,
143 ],
144 ],
145 'registerCallback' => [
146 'moduleId' => 'im',
147 'callback' => [self::class, 'onRegisterPlacementSidebar'],
148 ],
149 ],
150 self::IM_SMILES_SELECTOR => [
151 'options' => [
152 'extranet' => [
153 'type' => 'string',
154 'default' => 'N',
155 'require' => false,
156 ],
157 'role' => [
158 'type' => 'string',
159 'default' => 'USER',
160 'require' => false,
161 ],
162 'context' => [
163 'type' => 'string',
164 'default' => 'ALL',
165 'require' => false,
166 ],
167 ],
168 'registerCallback' => [
169 'moduleId' => 'im',
170 'callback' => [self::class, 'onRegisterPlacementSmilesSelector'],
171 ],
172 ],
173 ],
174 ],
175 ];
176 }
177
184 public static function onRegisterPlacementContextMenu(array $placementBind, array $placementInfo): array
185 {
186 $result =
187 RegistrationValidator::init($placementBind)
188 ->validateExtranet()
189 ->validateContext()
190 ->validateRole()
191 ;
192
193 return $result->getResult();
194 }
195
202 public static function onRegisterPlacementNavigation(array $placementBind, array $placementInfo): array
203 {
204 $result =
205 RegistrationValidator::init($placementBind)
206 ->validateIconName()
207 ->validateExtranet()
208 ->validateRole()
209 ;
210
211 return $result->getResult();
212 }
213
220 public static function onRegisterPlacementTextArea(array $placementBind, array $placementInfo): array
221 {
222 $result =
223 RegistrationValidator::init($placementBind)
224 ->validateIconName()
225 ->validateExtranet()
226 ->validateContext()
227 ->validateRole()
228 ->validateColor()
229 ->validateHeight()
230 ->validateWidth()
231 ;
232
233 return $result->getResult();
234 }
235
242 public static function onRegisterPlacementSidebar(array $placementBind, array $placementInfo): array
243 {
244 $result =
245 RegistrationValidator::init($placementBind)
246 ->validateIconName()
247 ->validateExtranet()
248 ->validateContext()
249 ->validateRole()
250 ->validateColor()
251 ;
252
253 return $result->getResult();
254 }
255
262 public static function onRegisterPlacementSmilesSelector(array $placementBind, array $placementInfo): array
263 {
264 $result =
265 RegistrationValidator::init($placementBind)
266 ->validateExtranet()
267 ->validateContext()
268 ->validateRole()
269 ;
270
271 return $result->getResult();
272 }
273
274}
static onRegisterPlacementSidebar(array $placementBind, array $placementInfo)
static onRegisterPlacementTextArea(array $placementBind, array $placementInfo)
static onRegisterPlacementNavigation(array $placementBind, array $placementInfo)
static onRegisterPlacementContextMenu(array $placementBind, array $placementInfo)
static onRegisterPlacementSmilesSelector(array $placementBind, array $placementInfo)