1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
rows.php
См. документацию.
1<?php
2
3namespace Bitrix\Main\Grid\Row;
4
5use Bitrix\Main\Grid\GridRequest;
6use Bitrix\Main\Grid\GridResponse;
7use Bitrix\Main\Grid\Row\Action\DataProvider;
8use Bitrix\Main\Grid\Row\Action\Action;
9use Bitrix\Main\Grid\UI\Response\GridResponseFactory;
10
20class Rows
21{
26 private array $actions;
27
29
34
40 {
41 $this->rowAssembler = $rowAssembler;
42
43 $this->actionsProviders = [];
44 foreach ($actionsProviders as $provider)
45 {
46 $this->actionsProviders[] = $provider;
47 }
48 }
49
57 public function prepareRows(iterable $rawRows): array
58 {
59 $result = [];
60
61 foreach ($rawRows as $row)
62 {
63 $result[] = $this->prepareRow($row);
64 }
65
66 return $this->rowAssembler->prepareRows($result);
67 }
68
76 protected function prepareRow(array $rawValue): array
77 {
78 $result = [
79 'data' => $rawValue,
80 ];
81
82 if (isset($rawValue['ID']))
83 {
84 $result['id'] = $rawValue['ID'];
85 }
86
87 if (!empty($this->actionsProviders))
88 {
89 $result['actions'] = [];
90
91 foreach ($this->actionsProviders as $provider)
92 {
93 $result['actions'] += $provider->prepareControls($rawValue);
94 }
95 }
96
97 return $result;
98 }
99
103 final public function getActions(): array
104 {
105 if (!isset($this->actions))
106 {
107 $this->actions = [];
108
109 foreach ($this->actionsProviders as $provider)
110 {
111 foreach ($provider->prepareActions() as $action)
112 {
113 $this->actions[$action::getId()] ??= $action;
114 }
115 }
116 }
117
118 return $this->actions;
119 }
120
128 final protected function getActionById(string $id): ?Action
129 {
130 if (empty($id))
131 {
132 return null;
133 }
134
135 return $this->getActions()[$id] ?? null;
136 }
137
146 {
147 $result = null;
148
149 if (!check_bitrix_sessid())
150 {
151 return null;
152 }
153
154 $actionId = $request->getRowActionId();
155 if (isset($actionId))
156 {
157 $action = $this->getActionById($actionId);
158 if ($action)
159 {
160 $result = $action->processRequest($request->getHttpRequest());
161 }
162 }
163
164 return
165 isset($result)
166 ? (new GridResponseFactory)->createFromResult($result)
167 : null
168 ;
169 }
170}
if(!Loader::includeModule('messageservice')) $provider
Определения callback_ednaruimhpx.php:21
if(!Loader::includeModule('catalog')) if(!AccessController::getCurrent() ->check(ActionDictionary::ACTION_PRICE_EDIT)) if(!check_bitrix_sessid()) $request
Определения catalog_reindex.php:36
processRequest(GridRequest $request)
Определения rows.php:145
getActionById(string $id)
Определения rows.php:128
prepareRow(array $rawValue)
Определения rows.php:76
__construct(RowAssembler $rowAssembler, DataProvider ... $actionsProviders)
Определения rows.php:39
array $actionsProviders
Определения rows.php:33
prepareRows(iterable $rawRows)
Определения rows.php:57
RowAssembler $rowAssembler
Определения rows.php:28
getActions()
Определения rows.php:103
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$result
Определения get_property_values.php:14
check_bitrix_sessid($varname='sessid')
Определения tools.php:4686
$action
Определения file_dialog.php:21