1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
ElementToGetDetailInfo.php
См. документацию.
1<?php
2
3namespace Bitrix\Lists\Api\Data\ServiceFactory;
4
5use Bitrix\Lists\Api\Request\ServiceFactory\GetElementDetailInfoRequest;
6use Bitrix\Main\ArgumentOutOfRangeException;
7
9{
10 private int $iBlockId;
11 private int $elementId;
12 private int $sectionId;
13
14 private array $additionalSelectFields = [];
15 private bool $isNeedCheckPermissions;
16
17 private function __construct(
18 int $iBlockId,
19 int $elementId,
20 int $sectionId
21 ){
22 $this->iBlockId = $iBlockId;
23 $this->elementId = $elementId;
24 $this->sectionId = $sectionId;
25 }
26
31 {
32 $iBlockId = self::validateId($request->iBlockId);
33 if ($iBlockId === null || $iBlockId === 0)
34 {
35 throw new ArgumentOutOfRangeException('iBlockId', 1, null);
36 }
37
38 $elementId = self::validateId($request->elementId);
39 if ($elementId === null)
40 {
41 throw new ArgumentOutOfRangeException('elementId', 0, null);
42 }
43
44 $sectionId = self::validateId($request->sectionId);
45 if ($sectionId === null)
46 {
47 throw new ArgumentOutOfRangeException('sectionId', 0, null);
48 }
49
50 $self = new self($iBlockId, $elementId, $sectionId);
51
52 if ($request->additionalSelectFields)
53 {
54 $self->setAdditionalSelectFields($request->additionalSelectFields);
55 }
56
57 $self->isNeedCheckPermissions = $request->needCheckPermission;
58
59 return $self;
60 }
61
62 private static function validateId(int $id): ?int
63 {
64 if ($id >= 0)
65 {
66 return $id;
67 }
68
69 return null;
70 }
71
72 private function setAdditionalSelectFields(array $selectFields): void
73 {
74 $allowedFields = ['FIELDS', 'PROPS', 'IBLOCK_ID', 'IBLOCK_SECTION_ID'];
75
76 $fields = [];
77 foreach ($selectFields as $fieldId)
78 {
79 if (in_array($fieldId, $allowedFields, true))
80 {
81 $fields[] = $fieldId;
82 }
83 }
84
85 $this->additionalSelectFields = $fields;
86 }
87
91 public function getIBlockId(): int
92 {
93 return $this->iBlockId;
94 }
95
99 public function getElementId(): int
100 {
101 return $this->elementId;
102 }
103
107 public function getSectionId(): int
108 {
109 return $this->sectionId;
110 }
111
116 {
117 return $this->additionalSelectFields;
118 }
119
123 public function isNeedCheckPermissions(): bool
124 {
125 return $this->isNeedCheckPermissions;
126 }
127}
$allowedFields
Определения push.php:9
if(!Loader::includeModule('catalog')) if(!AccessController::getCurrent() ->check(ActionDictionary::ACTION_PRICE_EDIT)) if(!check_bitrix_sessid()) $request
Определения catalog_reindex.php:36
static createFromRequest(GetElementDetailInfoRequest $request)
Определения ElementToGetDetailInfo.php:30
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$selectFields
Определения iblock_catalog_list.php:160
$iBlockId
Определения iblock_subelement_generator.php:45
$fields
Определения yandex_run.php:501