Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
iblocktype.php
1<?
2namespace Bitrix\Lists\Entity;
3
8
9class IblockType implements Errorable
10{
12
13 private $param;
14 private $params = [];
15
16 public function __construct(Param $param)
17 {
18 $this->param = $param;
19 $this->params = $param->getParams();
20
21 $this->errorCollection = new ErrorCollection;
22 }
23
29 public function getIblockTypeId()
30 {
31 $this->param->checkRequiredInputParams(["IBLOCK_CODE", "IBLOCK_ID"]);
32 if ($this->param->hasErrors())
33 {
34 $this->errorCollection->add($this->param->getErrors());
35 return null;
36 }
37
38 $filter = ["CHECK_PERMISSIONS" => "Y"];
39
40 if (empty($this->params["IBLOCK_ID"]))
41 {
42 $filter["=CODE"] = $this->params["IBLOCK_CODE"];
43 }
44 if (empty($this->params["IBLOCK_CODE"]))
45 {
46 $filter["=ID"] = $this->params["IBLOCK_ID"];
47 }
48
49 $queryObject = \CIBlock::getList([], $filter);
50 if ($iblock = $queryObject->fetch())
51 {
52 return ($iblock["IBLOCK_TYPE_ID"] ? $iblock["IBLOCK_TYPE_ID"] : null);
53 }
54 else
55 {
56 return null;
57 }
58 }
59}