Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
IBlockToGet.php
1<?php
2
4
6{
7 private IBlockListFilter $filter;
8 private array $order = ['SORT' => 'ASC'];
9 private bool $needCheckPermissions = true;
10
11 public function __construct(
12 IBlockListFilter $filter,
13 array $order = null,
14 )
15 {
16 $this->filter = $filter;
17 if ($order)
18 {
19 $this->setOrder($order);
20 }
21 }
22
23 public function getFilter(): IBlockListFilter
24 {
25 return $this->filter;
26 }
27
28 public function getOrmFilter(): array
29 {
30 return $this->filter->getOrmFilter();
31 }
32
33 public function setOrder(array $order): static
34 {
35 $allowedFields = ['SORT', 'NAME'];
36 $newOrder = [];
37
38 foreach ($order as $field => $sort)
39 {
40 if (in_array($field, $allowedFields, true))
41 {
42 $newOrder[$field] = $sort;
43 }
44 }
45
46 $this->order = $newOrder;
47
48 return $this;
49 }
50
51 public function getOrder(): array
52 {
53 return $this->order;
54 }
55
56 public function enableCheckPermissions(): static
57 {
58 $this->needCheckPermissions = true;
59
60 return $this;
61 }
62
63 public function disableCheckPermissions(): static
64 {
65 $this->needCheckPermissions = false;
66
67 return $this;
68 }
69
70 public function needCheckPermissions(): bool
71 {
72 return $this->needCheckPermissions;
73 }
74}
__construct(IBlockListFilter $filter, array $order=null,)