Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
moneyconfig.php
1
<?php
2
3
namespace
Bitrix\Main\Grid\Column\Editable
;
4
5
use
Bitrix\Currency\CurrencyManager
;
6
use
Bitrix\Main\Grid\Editor\Types
;
7
use
Bitrix\Main\Loader
;
8
12
class
MoneyConfig
extends
Config
13
{
18
private
array $currencyList;
19
private
?
bool
$isHtml;
20
24
public
function
__construct
(
string
$name, ?array $currencyList =
null
)
25
{
26
parent::__construct($name, Types::MONEY);
27
28
if
(isset($currencyList))
29
{
30
$this->currencyList = $currencyList;
31
}
32
elseif (
Loader::includeModule
(
'currency'
))
33
{
34
$this->currencyList = CurrencyManager::getSymbolList();
35
$this->
setHtml
(
true
);
36
}
37
else
38
{
39
$this->currencyList = [];
40
}
41
}
42
50
public
function
setHtml
(
bool
$value): self
51
{
52
$this->isHtml = $value;
53
54
return
$this;
55
}
56
62
private
function
getCurrenyListAsDropdown(): array
63
{
64
$result = [];
65
66
foreach
($this->currencyList as $value => $name)
67
{
68
$result[] = [
69
'VALUE'
=> $value,
70
'NAME'
=> $name,
71
];
72
}
73
74
return
$result;
75
}
76
80
public
function
toArray
(): array
81
{
82
$result = parent::toArray();
83
84
$result[
'CURRENCY_LIST'
] = $this->getCurrenyListAsDropdown();
85
86
if
(isset($this->isHtml))
87
{
88
$result[
'HTML_ENTITY'
] = $this->isHtml;
89
}
90
91
return
$result;
92
}
93
}
Bitrix\Currency\CurrencyManager
Definition
currencymanager.php:15
Bitrix\Main\Grid\Column\Editable\MoneyConfig
Definition
moneyconfig.php:13
Bitrix\Main\Grid\Column\Editable\MoneyConfig\setHtml
setHtml(bool $value)
Definition
moneyconfig.php:50
Bitrix\Main\Grid\Column\Editable\MoneyConfig\toArray
toArray()
Definition
moneyconfig.php:80
Bitrix\Main\Grid\Column\Editable\MoneyConfig\__construct
__construct(string $name, ?array $currencyList=null)
Definition
moneyconfig.php:24
Bitrix\Main\Grid\Editor\Types
Definition
types.php:11
Bitrix\Main\Loader
Definition
loader.php:12
Bitrix\Main\Loader\includeModule
static includeModule($moduleName)
Definition
loader.php:69
Bitrix\Main\Config
Definition
configuration.php:2
Bitrix\Main\Grid\Column\Editable
Definition
config.php:3
modules
main
lib
grid
column
editable
moneyconfig.php
Создано системой
1.10.0