Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
datacollection.php
1<?php
3
6use \Bitrix\Main\Localization\Loc;
7
8Loc::loadMessages(__FILE__);
9
11{
16 public static function getAll(string $languageId): array
17 {
18 return [
19 'RU' => [
20 'name' => Loc::getMessage('LOCATION_REPO_FRMT_RUS_NAME', null, $languageId),
21 'description' => Loc::getMessage('LOCATION_REPO_FRMT_RUS_DESCR', null, $languageId),
22 'delimiter' => ', ',
23 'sort' => 100,
24 'templateCollection' => [
26 '["#S#",[ADDRESS_LINE_1:N,ADDRESS_LINE_2,LOCALITY,ADM_LEVEL_2,ADM_LEVEL_1,COUNTRY,POSTAL_CODE]]',
27 TemplateType::AUTOCOMPLETE => '[", ",[LOCALITY,ADDRESS_LINE_1,ADDRESS_LINE_2]]',
28 TemplateType::ADDRESS_LINE_1 => '[", ",[STREET,BUILDING]]',
29 ],
30 'code' => 'RU',
31 'fieldForUnRecognized' => FieldType::ADDRESS_LINE_2,
32 'fieldCollection' => [
33 [
34 'sort' => 600,
35 'type' => FieldType::ADDRESS_LINE_2,
36 'name' => Loc::getMessage('LOCATION_REPO_FRMT_ADDR_2', null, $languageId),
37 'description' => ''
38 ],
39 [
40 'sort' => 500,
41 'type' => FieldType::ADDRESS_LINE_1,
42 'name' => Loc::getMessage('LOCATION_REPO_FRMT_ADDR_1', null, $languageId),
43 'description' => ''
44 ],
45 [
46 'sort' => 400,
47 'type' => FieldType::LOCALITY,
48 'name' => Loc::getMessage('LOCATION_REPO_FRMT_LOCALITY', null, $languageId),
49 'description' => ''
50 ],
51 [
52 'sort' => 350,
53 'type' => FieldType::ADM_LEVEL_2,
54 'name' => Loc::getMessage('LOCATION_REPO_FRMT_ADM_LEVEL_2', null, $languageId),
55 'description' =>''
56 ],
57 [
58 'sort' => 300,
59 'type' => FieldType::ADM_LEVEL_1,
60 'name' => Loc::getMessage('LOCATION_REPO_FRMT_REGION', null, $languageId),
61 'description' =>''
62 ],
63 [
64 'sort' => 200,
65 'type' => FieldType::COUNTRY,
66 'name' => Loc::getMessage('LOCATION_REPO_FRMT_COUNTRY', null, $languageId),
67 'description' => ''
68 ],
69 [
70 'sort' => 100,
71 'type' => FieldType::POSTAL_CODE,
72 'name' => Loc::getMessage('LOCATION_REPO_FRMT_POSTAL_CODE', null, $languageId),
73 'description' => ''
74 ]
75 ]
76 ],
77 'EU' => [
78 'name' => Loc::getMessage('LOCATION_REPO_FRMT_EU_NAME', null, $languageId),
79 'description' => Loc::getMessage('LOCATION_REPO_FRMT_EU_DESCR', null, $languageId),
80 'delimiter' => ' ',
81 'sort' => 200,
82 'templateCollection' => [
84 '["#S#",[ADDRESS_LINE_1:N,ADDRESS_LINE_2,[" ",[POSTAL_CODE,LOCALITY,ADM_LEVEL_2,'
85 . 'ADM_LEVEL_1]],COUNTRY]]',
86 TemplateType::AUTOCOMPLETE => '[", ",[ADDRESS_LINE_1,ADDRESS_LINE_2,[" ",[POSTAL_CODE,LOCALITY]]]]',
87 TemplateType::ADDRESS_LINE_1 => '[" ",[STREET,BUILDING]]',
88 ],
89 'code' => 'EU',
90 'fieldForUnRecognized' => FieldType::ADDRESS_LINE_2,
91 'fieldCollection' => [
92 [
93 'sort' => 600,
94 'type' => FieldType::ADDRESS_LINE_2,
95 'name' => Loc::getMessage('LOCATION_REPO_FRMT_ADDR_2', null, $languageId),
96 'description' => ''
97 ],
98 [
99 'sort' => 500,
100 'type' => FieldType::ADDRESS_LINE_1,
101 'name' => Loc::getMessage('LOCATION_REPO_FRMT_ADDR_1', null, $languageId),
102 'description' => ''
103 ],
104 [
105 'sort' => 400,
106 'type' => FieldType::LOCALITY,
107 'name' => Loc::getMessage('LOCATION_REPO_FRMT_LOCALITY', null, $languageId),
108 'description' => ''
109 ],
110 [
111 'sort' => 350,
112 'type' => FieldType::ADM_LEVEL_2,
113 'name' => Loc::getMessage('LOCATION_REPO_FRMT_ADM_LEVEL_2', null, $languageId),
114 'description' =>''
115 ],
116 [
117 'sort' => 300,
118 'type' => FieldType::ADM_LEVEL_1,
119 'name' => Loc::getMessage('LOCATION_REPO_FRMT_REGION', null, $languageId),
120 'description' =>''
121 ],
122 [
123 'sort' => 200,
124 'type' => FieldType::COUNTRY,
125 'name' => Loc::getMessage('LOCATION_REPO_FRMT_COUNTRY', null, $languageId),
126 'description' => ''
127 ],
128 [
129 'sort' => 100,
130 'type' => FieldType::POSTAL_CODE,
131 'name' => Loc::getMessage('LOCATION_REPO_FRMT_POSTAL_CODE', null, $languageId),
132 'description' => ''
133 ]
134 ]
135 ],
136 //todo: state
137 'US' => [
138 'name' => Loc::getMessage('LOCATION_REPO_FRMT_US_NAME', null, $languageId),
139 'description' => Loc::getMessage('LOCATION_REPO_FRMT_US_DESCR', null, $languageId),
140 'delimiter' => ' ',
141 'sort' => 300,
142 'templateCollection' => [
144 '["#S#",[ADDRESS_LINE_1:N,ADDRESS_LINE_2,[" ",[LOCALITY,ADM_LEVEL_2,ADM_LEVEL_1,'
145 . 'POSTAL_CODE:U]],COUNTRY:U]]',
146 TemplateType::AUTOCOMPLETE => '[", ",[LOCALITY,ADDRESS_LINE_1,ADDRESS_LINE_2]]',
147 TemplateType::ADDRESS_LINE_1 => '[", ",[STREET,BUILDING]]',
148 ],
149 'code' => 'US',
150 'fieldForUnRecognized' => FieldType::ADDRESS_LINE_2,
151 'fieldCollection' => [
152 [
153 'sort' => 700,
154 'type' => FieldType::ADDRESS_LINE_2,
155 'name' => Loc::getMessage('LOCATION_REPO_FRMT_ADDR_2', null, $languageId),
156 'description' => ''
157 ],
158 [
159 'sort' => 600,
160 'type' => FieldType::ADDRESS_LINE_1,
161 'name' => Loc::getMessage('LOCATION_REPO_FRMT_ADDR_1', null, $languageId),
162 'description' => ''
163 ],
164 [
165 'sort' => 500,
166 'type' => FieldType::LOCALITY,
167 'name' => Loc::getMessage('LOCATION_REPO_FRMT_LOCALITY', null, $languageId),
168 'description' => ''
169 ],
170 [
171 'sort' => 400,
172 'type' => FieldType::ADM_LEVEL_2,
173 'name' => Loc::getMessage('LOCATION_REPO_FRMT_ADM_LEVEL_2', null, $languageId),
174 'description' =>''
175 ],
176 [
177 'sort' => 300,
178 'type' => FieldType::ADM_LEVEL_1,
179 'name' => Loc::getMessage('LOCATION_REPO_FRMT_REGION', null, $languageId),
180 'description' =>''
181 ],
182 [
183 'sort' => 200,
184 'type' => FieldType::COUNTRY,
185 'name' => Loc::getMessage('LOCATION_REPO_FRMT_COUNTRY', null, $languageId),
186 'description' => ''
187 ],
188 [
189 'sort' => 100,
190 'type' => FieldType::POSTAL_CODE,
191 'name' => Loc::getMessage('LOCATION_REPO_FRMT_POSTAL_CODE', null, $languageId),
192 'description' => ''
193 ]
194 ]
195 ],
196 'UK' => [
197 'name' => Loc::getMessage('LOCATION_REPO_FRMT_UK_NAME', null, $languageId),
198 'description' => Loc::getMessage('LOCATION_REPO_FRMT_UK_DESCR', null, $languageId),
199 'delimiter' => ' ',
200 'sort' => 400,
201 'templateCollection' => [
203 '["#S#",[ADDRESS_LINE_1:N,ADDRESS_LINE_2,LOCALITY:U,ADM_LEVEL_2:U,ADM_LEVEL_1:U,'
204 . 'POSTAL_CODE:U,COUNTRY]]',
205 TemplateType::AUTOCOMPLETE => '[", ",[LOCALITY,ADDRESS_LINE_1,ADDRESS_LINE_2]]',
206 TemplateType::ADDRESS_LINE_1 => '[", ",[STREET,BUILDING]]',
207 ],
208 'code' => 'UK',
209 'fieldForUnRecognized' => FieldType::ADDRESS_LINE_2,
210 'fieldCollection' => [
211 [
212 'sort' => 400,
213 'type' => FieldType::ADDRESS_LINE_2,
214 'name' => Loc::getMessage('LOCATION_REPO_FRMT_ADDR_2', null, $languageId),
215 'description' => ''
216 ],
217 [
218 'sort' => 400,
219 'type' => FieldType::ADDRESS_LINE_1,
220 'name' => Loc::getMessage('LOCATION_REPO_FRMT_ADDR_1', null, $languageId),
221 'description' => ''
222 ],
223 [
224 'sort' => 300,
225 'type' => FieldType::LOCALITY,
226 'name' => Loc::getMessage('LOCATION_REPO_FRMT_LOCALITY', null, $languageId),
227 'description' => ''
228 ],
229 [
230 'sort' => 200,
231 'type' => FieldType::COUNTRY,
232 'name' => Loc::getMessage('LOCATION_REPO_FRMT_COUNTRY', null, $languageId),
233 'description' => ''
234 ],
235 [
236 'sort' => 100,
237 'type' => FieldType::POSTAL_CODE,
238 'name' => Loc::getMessage('LOCATION_REPO_FRMT_POSTAL_CODE', null, $languageId),
239 'description' => ''
240 ]
241 ]
242 ],
243 'RU_2' => [
244 'name' => Loc::getMessage('LOCATION_REPO_FRMT_RUS_2_NAME', null, $languageId),
245 'description' => Loc::getMessage('LOCATION_REPO_FRMT_RUS_2_DESCR', null, $languageId),
246 'delimiter' => ', ',
247 'sort' => 500,
248 'templateCollection' => [
250 '["#S#",[POSTAL_CODE,COUNTRY,ADM_LEVEL_1,ADM_LEVEL_2,LOCALITY,ADDRESS_LINE_1:N,'
251 . 'ADDRESS_LINE_2]]',
252 TemplateType::AUTOCOMPLETE => '[", ",[LOCALITY,ADDRESS_LINE_1,ADDRESS_LINE_2]]',
253 TemplateType::ADDRESS_LINE_1 => '[", ",[STREET,BUILDING]]',
254 ],
255 'code' => 'RU_2',
256 'fieldForUnRecognized' => FieldType::ADDRESS_LINE_2,
257 'fieldCollection' => [
258 [
259 'sort' => 600,
260 'type' => FieldType::ADDRESS_LINE_2,
261 'name' => Loc::getMessage('LOCATION_REPO_FRMT_ADDR_2', null, $languageId),
262 'description' => ''
263 ],
264 [
265 'sort' => 500,
266 'type' => FieldType::ADDRESS_LINE_1,
267 'name' => Loc::getMessage('LOCATION_REPO_FRMT_ADDR_1', null, $languageId),
268 'description' => ''
269 ],
270 [
271 'sort' => 400,
272 'type' => FieldType::LOCALITY,
273 'name' => Loc::getMessage('LOCATION_REPO_FRMT_LOCALITY', null, $languageId),
274 'description' => ''
275 ],
276 [
277 'sort' => 350,
278 'type' => FieldType::ADM_LEVEL_2,
279 'name' => Loc::getMessage('LOCATION_REPO_FRMT_ADM_LEVEL_2', null, $languageId),
280 'description' =>''
281 ],
282 [
283 'sort' => 300,
284 'type' => FieldType::ADM_LEVEL_1,
285 'name' => Loc::getMessage('LOCATION_REPO_FRMT_REGION', null, $languageId),
286 'description' =>''
287 ],
288 [
289 'sort' => 200,
290 'type' => FieldType::COUNTRY,
291 'name' => Loc::getMessage('LOCATION_REPO_FRMT_COUNTRY', null, $languageId),
292 'description' => ''
293 ],
294 [
295 'sort' => 100,
296 'type' => FieldType::POSTAL_CODE,
297 'name' => Loc::getMessage('LOCATION_REPO_FRMT_POSTAL_CODE', null, $languageId),
298 'description' => ''
299 ]
300 ]
301 ],
302 'BR' => [
303 'name' => Loc::getMessage('LOCATION_REPO_FRMT_BR_NAME', null, $languageId),
304 'description' => Loc::getMessage('LOCATION_REPO_FRMT_BR_DESCR', null, $languageId),
305 'delimiter' => ', ',
306 'sort' => 600,
307 'templateCollection' => [
309 '["#S#",[[", ",[ADDRESS_LINE_1:N,ADDRESS_LINE_2]],SUB_LOCALITY_LEVEL_1,[" ",[LOCALITY,'
310 . '[" - ",[ADM_LEVEL_2,ADM_LEVEL_1]]]],POSTAL_CODE,COUNTRY]]',
311 TemplateType::AUTOCOMPLETE => '[", ",[LOCALITY,ADDRESS_LINE_1,ADDRESS_LINE_2]]',
312 TemplateType::ADDRESS_LINE_1 => '[", ",[STREET,BUILDING]]',
313 ],
314 'code' => 'BR',
315 'fieldForUnRecognized' => FieldType::ADDRESS_LINE_2,
316 'fieldCollection' => [
317 [
318 'sort' => 800,
319 'type' => FieldType::ADDRESS_LINE_2,
320 'name' => Loc::getMessage('LOCATION_REPO_FRMT_ADDR_2', null, $languageId),
321 'description' => ''
322 ],
323 [
324 'sort' => 700,
325 'type' => FieldType::ADDRESS_LINE_1,
326 'name' => Loc::getMessage('LOCATION_REPO_FRMT_ADDR_1', null, $languageId),
327 'description' => ''
328 ],
329 [
330 'sort' => 600,
331 'type' => FieldType::LOCALITY,
332 'name' => Loc::getMessage('LOCATION_REPO_FRMT_LOCALITY', null, $languageId),
333 'description' => ''
334 ],
335 [
336 'sort' => 500,
337 'type' => FieldType::SUB_LOCALITY_LEVEL_1,
338 'name' => Loc::getMessage('LOCATION_REPO_FRMT_SUB_LOCALITY_LEVEL_1_NEIGHBORHOOD', null, $languageId),
339 'description' => ''
340 ],
341 [
342 'sort' => 400,
343 'type' => FieldType::ADM_LEVEL_2,
344 'name' => Loc::getMessage('LOCATION_REPO_FRMT_ADM_LEVEL_2_MUNICIPALITY', null, $languageId),
345 'description' => ''
346 ],
347 [
348 'sort' => 300,
349 'type' => FieldType::ADM_LEVEL_1,
350 'name' => Loc::getMessage('LOCATION_REPO_FRMT_STATE', null, $languageId),
351 'description' =>''
352 ],
353 [
354 'sort' => 200,
355 'type' => FieldType::POSTAL_CODE,
356 'name' => Loc::getMessage('LOCATION_REPO_FRMT_POSTAL_CODE', null, $languageId),
357 'description' => ''
358 ],
359 [
360 'sort' => 100,
361 'type' => FieldType::COUNTRY,
362 'name' => Loc::getMessage('LOCATION_REPO_FRMT_COUNTRY', null, $languageId),
363 'description' => ''
364 ],
365 ]
366 ],
367 'DE' => [
368 'name' => Loc::getMessage('LOCATION_REPO_FRMT_DE_NAME', null, $languageId),
369 'description' => Loc::getMessage('LOCATION_REPO_FRMT_EU_DESCR', null, $languageId),
370 'delimiter' => ' ',
371 'sort' => 700,
372 'templateCollection' => [
374 '["#S#",[ADDRESS_LINE_1:N,ADDRESS_LINE_2,[" ",[POSTAL_CODE,LOCALITY]],COUNTRY]]',
375 TemplateType::AUTOCOMPLETE => '[", ",[ADDRESS_LINE_1,ADDRESS_LINE_2,LOCALITY]]',
376 TemplateType::ADDRESS_LINE_1 => '[" ",[STREET,BUILDING]]',
377 ],
378 'code' => 'DE',
379 'fieldForUnRecognized' => FieldType::ADDRESS_LINE_2,
380 'fieldCollection' => [
381 [
382 'sort' => 100,
383 'type' => FieldType::ADDRESS_LINE_1,
384 'name' => Loc::getMessage('LOCATION_REPO_FRMT_ADDR_1', null, $languageId),
385 'description' => ''
386 ],
387 [
388 'sort' => 200,
389 'type' => FieldType::ADDRESS_LINE_2,
390 'name' => Loc::getMessage('LOCATION_REPO_FRMT_ADDR_2', null, $languageId),
391 'description' => ''
392 ],
393 [
394 'sort' => 300,
395 'type' => FieldType::POSTAL_CODE,
396 'name' => Loc::getMessage('LOCATION_REPO_FRMT_POSTAL_CODE', null, $languageId),
397 'description' => ''
398 ],
399 [
400 'sort' => 400,
401 'type' => FieldType::LOCALITY,
402 'name' => Loc::getMessage('LOCATION_REPO_FRMT_LOCALITY', null, $languageId),
403 'description' => ''
404 ],
405 [
406 'sort' => 500,
407 'type' => FieldType::COUNTRY,
408 'name' => Loc::getMessage('LOCATION_REPO_FRMT_COUNTRY', null, $languageId),
409 'description' => ''
410 ],
411 ]
412 ]
413 ];
414 }
415
421 public static function getByCode(string $code, string $languageId): ?array
422 {
423 $data = self::getAll($languageId);
424 return $data[$code] ?? null;
425 }
426}
static getByCode(string $code, string $languageId)
static loadMessages($file)
Definition loc.php:64
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29