Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
iblocksettings.php
1
<?php
2
3
namespace
Bitrix\Iblock\Grid\Entity
;
4
5
use
Bitrix\Iblock\IblockTable
;
6
use
Bitrix\Main
;
7
use
Bitrix\Main\ArgumentException
;
8
use
Bitrix\Main\Config\Option
;
9
use
Bitrix\Main\SystemException
;
10
11
class
IblockSettings
extends
Main\Grid\Settings
12
{
13
protected
array
$iblockFields
;
14
15
private
int
$iblockId;
16
private
string
$iblockTypeId;
17
private
string
$listMode;
18
private
bool
$isAllowedIblockSections =
false
;
19
private
bool
$isShowedXmlId =
false
;
20
21
public
function
__construct
(array $params)
22
{
23
parent::__construct($params);
24
25
$this->iblockId = $params[
'IBLOCK_ID'
] ?? 0;
26
if
($this->iblockId === 0)
27
{
28
throw
new
ArgumentException
(
'Collection does not contain value for iblock id.'
,
'params'
);
29
}
30
31
$this->
init
();
32
}
33
34
protected
function
init
(): void
35
{
36
$this->iblockFields =
IblockTable::getRow
([
37
'select'
=> [
38
'*'
,
39
'TYPE_SECTIONS'
=>
'TYPE.SECTIONS'
,
40
],
41
'filter'
=> [
42
'=ID'
=> $this->iblockId,
43
'=ACTIVE'
=>
'Y'
,
44
],
45
]);
46
if
(empty($this->iblockFields))
47
{
48
throw
new
SystemException
(
'Not found active iblock'
);
49
}
50
51
$this->iblockTypeId = $this->iblockFields[
'IBLOCK_TYPE_ID'
];
52
$this->
isAllowedIblockSections
= $this->iblockFields[
'TYPE_SECTIONS'
] ===
'Y'
;
53
54
if
(
55
$this->iblockFields[
'LIST_MODE'
] ===
IblockTable::LIST_MODE_SEPARATE
56
|| $this->iblockFields[
'LIST_MODE'
] ===
IblockTable::LIST_MODE_COMBINED
57
)
58
{
59
$this->listMode = $this->iblockFields[
'LIST_MODE'
];
60
}
61
else
62
{
63
$this->listMode =
64
Option::get(
'iblock'
,
'combined_list_mode'
) ===
'Y'
65
?
IblockTable::LIST_MODE_COMBINED
66
:
IblockTable::LIST_MODE_SEPARATE
67
;
68
}
69
}
70
71
public
function
getIblockId
(): int
72
{
73
return
$this->iblockId;
74
}
75
76
public
function
getIblockTypeId
(): string
77
{
78
return
$this->iblockTypeId;
79
}
80
81
public
function
getListMode
(): string
82
{
83
return
$this->listMode;
84
}
85
86
public
function
setListMode
(
string
$value): self
87
{
88
$this->listMode = $value;
89
90
return
$this;
91
}
92
93
public
function
isAllowedIblockSections
(): bool
94
{
95
return
$this->isAllowedIblockSections;
96
}
97
98
public
function
setAllowedIblockSections
(
bool
$value): self
99
{
100
$this->
isAllowedIblockSections
= $value;
101
102
return
$this;
103
}
104
105
public
function
isShowedXmlId
(): bool
106
{
107
return
$this->isShowedXmlId;
108
}
109
110
public
function
setShowedXmlId
(
bool
$value): self
111
{
112
$this->
isShowedXmlId
= $value;
113
114
return
$this;
115
}
116
}
Bitrix\Iblock\Grid\Entity\IblockSettings
Definition
iblocksettings.php:12
Bitrix\Iblock\Grid\Entity\IblockSettings\$iblockFields
array $iblockFields
Definition
iblocksettings.php:13
Bitrix\Iblock\Grid\Entity\IblockSettings\getIblockId
getIblockId()
Definition
iblocksettings.php:71
Bitrix\Iblock\Grid\Entity\IblockSettings\setAllowedIblockSections
setAllowedIblockSections(bool $value)
Definition
iblocksettings.php:98
Bitrix\Iblock\Grid\Entity\IblockSettings\getIblockTypeId
getIblockTypeId()
Definition
iblocksettings.php:76
Bitrix\Iblock\Grid\Entity\IblockSettings\init
init()
Definition
iblocksettings.php:34
Bitrix\Iblock\Grid\Entity\IblockSettings\__construct
__construct(array $params)
Definition
iblocksettings.php:21
Bitrix\Iblock\Grid\Entity\IblockSettings\getListMode
getListMode()
Definition
iblocksettings.php:81
Bitrix\Iblock\Grid\Entity\IblockSettings\setListMode
setListMode(string $value)
Definition
iblocksettings.php:86
Bitrix\Iblock\Grid\Entity\IblockSettings\setShowedXmlId
setShowedXmlId(bool $value)
Definition
iblocksettings.php:110
Bitrix\Iblock\Grid\Entity\IblockSettings\isShowedXmlId
isShowedXmlId()
Definition
iblocksettings.php:105
Bitrix\Iblock\Grid\Entity\IblockSettings\isAllowedIblockSections
isAllowedIblockSections()
Definition
iblocksettings.php:93
Bitrix\Iblock\IblockTable
Definition
iblocktable.php:79
Bitrix\Iblock\IblockTable\LIST_MODE_COMBINED
const LIST_MODE_COMBINED
Definition
iblocktable.php:91
Bitrix\Iblock\IblockTable\LIST_MODE_SEPARATE
const LIST_MODE_SEPARATE
Definition
iblocktable.php:90
Bitrix\Main\ArgumentException
Definition
exception.php:34
Bitrix\Main\Config\Option
Definition
option.php:15
Bitrix\Main\Grid\Settings
Definition
settings.php:8
Bitrix\Main\ORM\Data\DataManager\getRow
static getRow(array $parameters)
Definition
datamanager.php:410
Bitrix\Main\SystemException
Definition
exception.php:8
Bitrix\Iblock\Grid\Entity
Definition
elementsettings.php:3
Bitrix\Main
modules
iblock
lib
grid
entity
iblocksettings.php
Создано системой
1.10.0