Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
iblocksettings.php
1<?php
2
4
10
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'
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}
static getRow(array $parameters)