1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
Menu.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Im\V2\Message\Param;
4
5
use Bitrix\Im;
6
use Bitrix\Im\V2\Message\Param;
7
use Bitrix\Im\V2\Result;
8
use Bitrix\Main\ArgumentException;
9
10
class
Menu
extends
Param
11
{
12
protected
?
Im\Bot\ContextMenu
$menu
;
13
protected
bool
$isValid
=
true
;
14
19
public
function
setValue
(
$value
): self
20
{
21
if
(
$value
===
null
||
$value
=== $this->
getDefaultValue
())
22
{
23
return
$this->
unsetValue
();
24
}
25
if
(
$value
instanceof
Im
\
Bot
\ContextMenu)
26
{
27
$this->menu =
$value
;
28
}
29
elseif
(!empty(
$value
))
30
{
31
$this->menu =
Im\Bot\ContextMenu::getByJson
(
$value
);
32
}
33
34
if
(isset($this->menu))
35
{
36
$this->value = $this->menu->getArray();
37
$this->jsonValue = $this->menu->getJson();
38
}
39
40
return
$this;
41
}
42
46
public
function
getValue
()
47
{
48
return
$this->value ?? $this->
getDefaultValue
();
49
}
50
51
public
function
getDefaultValue
()
52
{
53
return
'N'
;
54
}
55
60
public
function
saveValueFilter
(
$value
)
61
{
62
return
''
;
63
}
64
69
public
function
saveJsonFilter
(
$value
)
70
{
71
return
$this->jsonValue
;
72
}
73
78
public
function
loadJsonFilter
(
$value
)
79
{
80
if
(!empty(
$value
))
81
{
82
try
83
{
84
$this->value =
\Bitrix\Main\Web\Json::decode
(
$value
);
85
}
86
catch
(
ArgumentException
$ext)
87
{}
88
}
89
else
90
{
91
$value
=
null
;
92
}
93
94
return
$value
;
95
}
96
100
public
function
toRestFormat
()
101
{
102
return
$this->
getValue
();
103
}
104
108
public
function
toPullFormat
()
109
{
110
return
$this->
getValue
();
111
}
112
116
public
function
isValid
():
Result
117
{
118
$result
=
new
Result
();
119
120
if
($this->
isValid
&& (!isset($this->menu) || $this->menu->IsAllowSize()))
121
{
122
return
$result
;
123
}
124
125
return
$result
->addError(
new
ParamError
(
ParamError::MENU_ERROR
));
126
}
127
}
Bitrix\Im\Bot\ContextMenu
Определения
contextmenu.php:12
Bitrix\Im\Bot\ContextMenu\getByJson
static getByJson($params, $textReplace=array(), $options=Array())
Определения
contextmenu.php:83
Bitrix\Im\V2\Message\Param\Menu
Определения
Menu.php:11
Bitrix\Im\V2\Message\Param\Menu\$isValid
bool $isValid
Определения
Menu.php:13
Bitrix\Im\V2\Message\Param\Menu\toPullFormat
toPullFormat()
Определения
Menu.php:108
Bitrix\Im\V2\Message\Param\Menu\setValue
setValue($value)
Определения
Menu.php:19
Bitrix\Im\V2\Message\Param\Menu\$menu
Im Bot ContextMenu $menu
Определения
Menu.php:12
Bitrix\Im\V2\Message\Param\Menu\isValid
isValid()
Определения
Menu.php:116
Bitrix\Im\V2\Message\Param\Menu\saveJsonFilter
saveJsonFilter($value)
Определения
Menu.php:69
Bitrix\Im\V2\Message\Param\Menu\loadJsonFilter
loadJsonFilter($value)
Определения
Menu.php:78
Bitrix\Im\V2\Message\Param\Menu\getValue
getValue()
Определения
Menu.php:46
Bitrix\Im\V2\Message\Param\Menu\saveValueFilter
saveValueFilter($value)
Определения
Menu.php:60
Bitrix\Im\V2\Message\Param\Menu\toRestFormat
toRestFormat()
Определения
Menu.php:100
Bitrix\Im\V2\Message\Param\Menu\getDefaultValue
getDefaultValue()
Определения
Menu.php:51
Bitrix\Im\V2\Message\Param\ParamError
Определения
ParamError.php:9
Bitrix\Im\V2\Message\Param\ParamError\MENU_ERROR
const MENU_ERROR
Определения
ParamError.php:11
Bitrix\Im\V2\Message\Param\$value
$value
Определения
Param.php:46
Bitrix\Im\V2\Message\Param\unsetValue
unsetValue()
Определения
Param.php:223
Bitrix\Im\V2\Message\Param\$jsonValue
string $jsonValue
Определения
Param.php:49
Bitrix\Main\ArgumentException
Определения
ArgumentException.php:9
Bitrix\Main\DB\Result
Определения
result.php:20
Bitrix\Main\Web\Json\decode
static decode($data)
Определения
json.php:50
$result
$result
Определения
get_property_values.php:14
Bitrix\Im\Bot
Определения
contextmenu.php:9
Bitrix\Im\V2\Chat\Param
Bitrix\Im
elseif
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения
prolog_main_admin.php:393
bitrix
modules
im
lib
V2
Message
Param
Menu.php
Создано системой
1.14.0