Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
lockedbutton.php
1
<?php
2
namespace
Bitrix\UI\Buttons
;
3
10
class
LockedButton
extends
Button
11
{
12
protected
bool
$hasHint
=
false
;
13
17
protected
function
getDefaultParameters
()
18
{
19
return
[
20
'tag'
=>
Tag::BUTTON
,
21
];
22
}
23
27
protected
function
init
(array $params = [])
28
{
29
parent::init($params);
30
31
$this->
setDisabled
();
32
33
$this->
getAttributeCollection
()->addClass(
'ui-btn-icon-lock'
);
34
35
$hint = $params[
'hint'
] ??
null
;
36
if
($hint)
37
{
38
$this->hasHint =
true
;
39
$this->
addDataAttribute
(
'hint'
, $hint);
40
$this->
addDataAttribute
(
'hint-no-icon'
,
true
);
41
}
42
}
43
47
protected
function
listExtensions
()
48
{
49
return
[
50
'ui.hint'
,
51
];
52
}
53
57
public
function
render
($jsInit =
true
)
58
{
59
$output = parent::render($jsInit);
60
$uniqId = $this->
getUniqId
();
61
62
// execute in any case despite $jsInit
63
if
($this->hasHint)
64
{
65
// HACK: hint does not work on locked buttons because mouse(enter/out) events don't work for disabled buttons. So we remove disabled attribute
66
$output .=
67
"<script>
68
setTimeout(() => {
69
const lockedButton = BX.UI.ButtonManager.getByUniqid('{$uniqId}');
70
if (lockedButton && lockedButton.button)
71
{
72
lockedButton.button.removeAttribute('disabled');
73
}
74
75
BX.UI.Hint.init();
76
}, 200);
77
</script>"
;
78
}
79
80
81
return
$output;
82
}
83
}
Bitrix\UI\Buttons\BaseButton\getUniqId
getUniqId()
Definition
basebutton.php:257
Bitrix\UI\Buttons\BaseButton\getAttributeCollection
getAttributeCollection()
Definition
basebutton.php:422
Bitrix\UI\Buttons\BaseButton\addDataAttribute
addDataAttribute($name, $value=null)
Definition
basebutton.php:385
Bitrix\UI\Buttons\Button
Definition
button.php:6
Bitrix\UI\Buttons\Button\setDisabled
setDisabled($flag=true)
Definition
button.php:259
Bitrix\UI\Buttons\LockedButton
Definition
lockedbutton.php:11
Bitrix\UI\Buttons\LockedButton\listExtensions
listExtensions()
Definition
lockedbutton.php:47
Bitrix\UI\Buttons\LockedButton\$hasHint
bool $hasHint
Definition
lockedbutton.php:12
Bitrix\UI\Buttons\LockedButton\render
render($jsInit=true)
Definition
lockedbutton.php:57
Bitrix\UI\Buttons\LockedButton\init
init(array $params=[])
Definition
lockedbutton.php:27
Bitrix\UI\Buttons\LockedButton\getDefaultParameters
getDefaultParameters()
Definition
lockedbutton.php:17
Bitrix\UI\Buttons\Tag\BUTTON
const BUTTON
Definition
tag.php:6
Bitrix\UI\Buttons
Definition
addbutton.php:3
modules
ui
lib
buttons
lockedbutton.php
Создано системой
1.10.0