Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
ComponentParams.php
1<?php
2
4
10
12{
13 protected ?string $type = Param::TYPE_JSON;
14
15 public function setValue($value): self
16 {
17 $this->value = $value;
18 $this->jsonValue = Json::encode($value);
19
20 return $this;
21 }
22 public function saveValueFilter($value)
23 {
24 return '';
25 }
26
27 public function loadValueFilter($value)
28 {
29 if (!empty($value))
30 {
32 }
33 else
34 {
35 $value = null;
36 }
37
38 return $value;
39 }
40
41 public function saveJsonFilter($value)
42 {
43 return $this->jsonValue;
44 }
45
46 public function loadJsonFilter($value)
47 {
48 if (!empty($value))
49 {
50 try
51 {
52 $this->value = \Bitrix\Main\Web\Json::decode($value);
53 }
54 catch (ArgumentException $ext)
55 {}
56 }
57 else
58 {
59 $value = null;
60 }
61
62 return $value;
63 }
64
65 public function toRestFormat(): ?array
66 {
67 return Converter::toJson()->process($this->getValue());
68 }
69
70 public function toPullFormat(): ?array
71 {
72 return Converter::toJson()->process($this->getValue());
73 }
74}
static decodeEmoji($text)
Definition text.php:359