2namespace Bitrix\Iblock;
4use Bitrix\Main\Localization\Loc;
6use Bitrix\Main\ORM\Event;
7use Bitrix\Main\ORM\EventResult;
8use Bitrix\Main\ORM\Fields\Validators;
9use Bitrix\Main\Type\DateTime;
66 private static array $oldValues = [];
75 return 'b_iblock_section';
87 'data_type' =>
'integer',
89 'autocomplete' =>
true,
90 'title' => Loc::getMessage(
'IBLOCK_SECTION_ENTITY_ID_FIELD'),
93 'data_type' =>
'datetime',
95 'default_value' =>
function()
100 'title' => Loc::getMessage(
'IBLOCK_SECTION_ENTITY_TIMESTAMP_X_FIELD'),
103 'data_type' =>
'integer',
104 'title' => Loc::getMessage(
'IBLOCK_SECTION_ENTITY_MODIFIED_BY_FIELD'),
107 'data_type' =>
'datetime',
108 'title' => Loc::getMessage(
'IBLOCK_SECTION_ENTITY_DATE_CREATE_FIELD'),
111 'data_type' =>
'integer',
112 'title' => Loc::getMessage(
'IBLOCK_SECTION_ENTITY_CREATED_BY_FIELD'),
115 'data_type' =>
'integer',
117 'title' => Loc::getMessage(
'IBLOCK_SECTION_ENTITY_IBLOCK_ID_FIELD'),
119 'IBLOCK_SECTION_ID' => [
120 'data_type' =>
'integer',
121 'title' => Loc::getMessage(
'IBLOCK_SECTION_ENTITY_IBLOCK_SECTION_ID_FIELD'),
124 'data_type' =>
'boolean',
125 'values' => [
'N',
'Y'],
126 'default_value' =>
'Y',
127 'title' => Loc::getMessage(
'IBLOCK_SECTION_ENTITY_ACTIVE_FIELD'),
130 'data_type' =>
'boolean',
131 'values' => [
'N',
'Y'],
132 'title' => Loc::getMessage(
'IBLOCK_SECTION_ENTITY_GLOBAL_ACTIVE_FIELD'),
135 'data_type' =>
'integer',
136 'title' => Loc::getMessage(
'IBLOCK_SECTION_ENTITY_SORT_FIELD'),
139 'data_type' =>
'string',
141 'validation' =>
function()
147 'title' => Loc::getMessage(
'IBLOCK_SECTION_ENTITY_NAME_FIELD'),
150 'data_type' =>
'integer',
151 'title' => Loc::getMessage(
'IBLOCK_SECTION_ENTITY_PICTURE_FIELD'),
154 'data_type' =>
'integer',
155 'title' => Loc::getMessage(
'IBLOCK_SECTION_ENTITY_LEFT_MARGIN_FIELD'),
158 'data_type' =>
'integer',
159 'title' => Loc::getMessage(
'IBLOCK_SECTION_ENTITY_RIGHT_MARGIN_FIELD'),
162 'data_type' =>
'integer',
163 'title' => Loc::getMessage(
'IBLOCK_SECTION_ENTITY_DEPTH_LEVEL_FIELD'),
166 'data_type' =>
'text',
167 'title' => Loc::getMessage(
'IBLOCK_SECTION_ENTITY_DESCRIPTION_FIELD'),
169 'DESCRIPTION_TYPE' => [
170 'data_type' =>
'enum',
176 'default_value' => self::TYPE_TEXT,
177 'title' => Loc::getMessage(
'IBLOCK_SECTION_ENTITY_DESCRIPTION_TYPE_FIELD'),
179 'SEARCHABLE_CONTENT' => [
180 'data_type' =>
'text',
181 'title' => Loc::getMessage(
'IBLOCK_SECTION_ENTITY_SEARCHABLE_CONTENT_FIELD'),
184 'data_type' =>
'string',
185 'validation' =>
function()
191 'title' => Loc::getMessage(
'IBLOCK_SECTION_ENTITY_CODE_FIELD'),
194 'data_type' =>
'string',
195 'validation' =>
function()
201 'title' => Loc::getMessage(
'IBLOCK_SECTION_ENTITY_XML_ID_FIELD'),
204 'data_type' =>
'string',
205 'validation' =>
function()
211 'title' => Loc::getMessage(
'IBLOCK_SECTION_ENTITY_TMP_ID_FIELD'),
213 'DETAIL_PICTURE' => [
214 'data_type' =>
'integer',
215 'title' => Loc::getMessage(
'IBLOCK_SECTION_ENTITY_DETAIL_PICTURE_FIELD'),
217 'SOCNET_GROUP_ID' => [
218 'data_type' =>
'integer',
219 'title' => Loc::getMessage(
'IBLOCK_SECTION_ENTITY_SOCNET_GROUP_ID_FIELD'),
222 'data_type' =>
'Bitrix\Iblock\Iblock',
223 'reference' => [
'=this.IBLOCK_ID' =>
'ref.ID'],
225 'PARENT_SECTION' => [
226 'data_type' =>
'Bitrix\Iblock\Section',
227 'reference' => [
'=this.IBLOCK_SECTION_ID' =>
'ref.ID'],
229 'CREATED_BY_USER' => [
230 'data_type' =>
'Bitrix\Main\User',
231 'reference' => [
'=this.CREATED_BY' =>
'ref.ID'],
233 'MODIFIED_BY_USER' => [
234 'data_type' =>
'Bitrix\Main\User',
235 'reference' => [
'=this.MODIFIED_BY' =>
'ref.ID'],
250 if (!isset(
$fields[
'TIMESTAMP_X']))
263 $section =
$event->getParameter(
'object');
264 $section->fill([
'IBLOCK_ID',
'IBLOCK_SECTION_ID',
'NAME',
'SORT']);
267 \CIBlock::clearIblockTagCache($section->getIblockId());
270 \CIBlockSection::recountTreeAfterAdd($section->collectValues());
283 if (!isset(
$fields[
'TIMESTAMP_X']))
296 $section =
$event->getParameter(
'object');
299 $row = static::getRow([
312 '=ID' => $section->getId(),
315 self::$oldValues = $row !==
null ? $row : [];
321 $section =
$event->getParameter(
'object');
322 $section->fill([
'IBLOCK_ID',
'IBLOCK_SECTION_ID',
'NAME',
'SORT',
'ACTIVE']);
325 \CIBlock::clearIblockTagCache($section->getIblockId());
328 \CIBlockSection::recountTreeAfterUpdate($section->collectValues(), self::$oldValues);
329 self::$oldValues = [];
334 $section = static::wakeUpObject(
$event->getParameter(
'id'));
335 $section->fill([
'IBLOCK_ID']);
338 \CIBlock::clearIblockTagCache($section->getIblockId());
344 $primary =
$event->getParameter(
'id');
345 if (!is_array($primary))
347 $primary = [
'ID' => $primary];
349 \CIBlockSection::recountTreeOnDelete($primary);
static onDelete(Event $event)
static onBeforeAdd(Event $event)
static onAfterDelete(Event $event)
static onBeforeUpdate(Event $event)
static onAfterUpdate(Event $event)
static onAfterAdd(Event $event)
static onUpdate(Event $event)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)