62 private static array $oldValues = [];
71 return 'b_iblock_section';
83 'data_type' =>
'integer',
85 'autocomplete' =>
true,
88 'TIMESTAMP_X' => array(
89 'data_type' =>
'datetime',
93 'MODIFIED_BY' => array(
94 'data_type' =>
'integer',
97 'DATE_CREATE' => array(
98 'data_type' =>
'datetime',
101 'CREATED_BY' => array(
102 'data_type' =>
'integer',
105 'IBLOCK_ID' => array(
106 'data_type' =>
'integer',
110 'IBLOCK_SECTION_ID' => array(
111 'data_type' =>
'integer',
112 'title' =>
Loc::getMessage(
'IBLOCK_SECTION_ENTITY_IBLOCK_SECTION_ID_FIELD'),
115 'data_type' =>
'boolean',
116 'values' => array(
'N',
'Y'),
117 'default_value' =>
'Y',
120 'GLOBAL_ACTIVE' => array(
121 'data_type' =>
'boolean',
122 'values' => array(
'N',
'Y'),
123 'title' =>
Loc::getMessage(
'IBLOCK_SECTION_ENTITY_GLOBAL_ACTIVE_FIELD'),
126 'data_type' =>
'integer',
130 'data_type' =>
'string',
132 'validation' => array(__CLASS__,
'validateName'),
136 'data_type' =>
'integer',
139 'LEFT_MARGIN' => array(
140 'data_type' =>
'integer',
143 'RIGHT_MARGIN' => array(
144 'data_type' =>
'integer',
145 'title' =>
Loc::getMessage(
'IBLOCK_SECTION_ENTITY_RIGHT_MARGIN_FIELD'),
147 'DEPTH_LEVEL' => array(
148 'data_type' =>
'integer',
151 'DESCRIPTION' => array(
152 'data_type' =>
'text',
155 'DESCRIPTION_TYPE' => array(
156 'data_type' =>
'enum',
158 'values' => array(
'text',
'html'),
159 'default_value' =>
'text',
160 'title' =>
Loc::getMessage(
'IBLOCK_SECTION_ENTITY_DESCRIPTION_TYPE_FIELD'),
162 'SEARCHABLE_CONTENT' => array(
163 'data_type' =>
'text',
164 'title' =>
Loc::getMessage(
'IBLOCK_SECTION_ENTITY_SEARCHABLE_CONTENT_FIELD'),
167 'data_type' =>
'string',
168 'validation' => array(__CLASS__,
'validateCode'),
172 'data_type' =>
'string',
173 'validation' => array(__CLASS__,
'validateXmlId'),
177 'data_type' =>
'string',
178 'validation' => array(__CLASS__,
'validateTmpId'),
181 'DETAIL_PICTURE' => array(
182 'data_type' =>
'integer',
183 'title' =>
Loc::getMessage(
'IBLOCK_SECTION_ENTITY_DETAIL_PICTURE_FIELD'),
185 'SOCNET_GROUP_ID' => array(
186 'data_type' =>
'integer',
187 'title' =>
Loc::getMessage(
'IBLOCK_SECTION_ENTITY_SOCNET_GROUP_ID_FIELD'),
190 'data_type' =>
'Bitrix\Iblock\Iblock',
191 'reference' => array(
'=this.IBLOCK_ID' =>
'ref.ID'),
193 'PARENT_SECTION' => array(
194 'data_type' =>
'Bitrix\Iblock\Section',
195 'reference' => array(
'=this.IBLOCK_SECTION_ID' =>
'ref.ID'),
197 'CREATED_BY_USER' => array(
198 'data_type' =>
'Bitrix\Main\User',
199 'reference' => array(
'=this.CREATED_BY' =>
'ref.ID'),
201 'MODIFIED_BY_USER' => array(
202 'data_type' =>
'Bitrix\Main\User',
203 'reference' => array(
'=this.MODIFIED_BY' =>
'ref.ID'),
216 new ORM\Fields\Validators\LengthValidator(
null, 255),
228 new ORM\Fields\Validators\LengthValidator(
null, 255),
240 new ORM\Fields\Validators\LengthValidator(
null, 255),
252 new ORM\Fields\Validators\LengthValidator(
null, 40),
260 $section->fill([
'IBLOCK_ID',
'IBLOCK_SECTION_ID',
'NAME',
'SORT']);
263 \CIBlock::clearIblockTagCache($section->getIblockId());
266 \CIBlockSection::recountTreeAfterAdd($section->collectValues());
269 public static function onUpdate(Event $event)
272 $section = $event->getParameter(
'object');
275 $row = static::getRow([
288 '=ID' => $section->getId(),
291 self::$oldValues = $row !==
null ? $row : [];
297 $section = $event->getParameter(
'object');
298 $section->fill([
'IBLOCK_ID',
'IBLOCK_SECTION_ID',
'NAME',
'SORT',
'ACTIVE']);
301 \CIBlock::clearIblockTagCache($section->getIblockId());
304 \CIBlockSection::recountTreeAfterUpdate($section->collectValues(), self::$oldValues);
305 self::$oldValues = [];
310 $section = static::wakeUpObject($event->
getParameter(
'id'));
311 $section->fill([
'IBLOCK_ID']);
314 \CIBlock::clearIblockTagCache($section->getIblockId());
321 if (!is_array($primary))
323 $primary = [
'ID' => $primary];
325 \CIBlockSection::recountTreeOnDelete($primary);
static loadMessages($file)
static getMessage($code, $replace=null, $language=null)
static onAfterUpdate(Event $event)
static onAfterAdd(Event $event)
static onUpdate(Event $event)