1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
groupaction.php
См. документацию.
1<?php
2
3namespace Bitrix\Main\Grid\Panel\Action;
4
5use Bitrix\Main\Filter\Filter;
6use Bitrix\Main\Grid\Panel\Action\Group\GroupChildAction;
7use Bitrix\Main\Grid\Panel\Actions;
8use Bitrix\Main\Grid\Panel\Types;
9use Bitrix\Main\HttpRequest;
10use Bitrix\Main\Localization\Loc;
11use Bitrix\Main\Result;
12
13abstract class GroupAction implements Action
14{
18 private array $items;
19
25 final public static function getId(): string
26 {
27 return 'group_action';
28 }
29
33 abstract protected function prepareChildItems(): array;
34
40 private function getChildItems(): array
41 {
42 $this->items ??= $this->prepareChildItems();
43
44 return $this->items;
45 }
46
50 public function getControl(): ?array
51 {
52 $items = $this->getGroupDropdownItems();
53 if (empty($items))
54 {
55 return null;
56 }
57
58 return [
59 'TYPE' => Types::DROPDOWN,
60 'ID' => static::getId(),
61 'NAME' => static::getId(),
62 'ITEMS' => [
63 [
64 'NAME' => Loc::getMessage('MAIN_GRID_PANEL_GROUP_ACTIONS_ITEM_PLACEHOLDER'),
65 'VALUE' => 'default',
66 'ONCHANGE' => [
67 [
68 'ACTION' => Actions::RESET_CONTROLS,
69 ],
70 ],
71 ],
72 ... $items,
73 ],
74 ];
75 }
76
82 private function getGroupDropdownItems(): array
83 {
84 $result = [];
85
86 foreach ($this->getChildItems() as $item)
87 {
88 $result[] = $item->getDropdownItem();
89 }
90
91 return $result;
92 }
93
97 final public function processRequest(HttpRequest $request, bool $isSelectedAllRows, ?Filter $filter): ?Result
98 {
99 $controls = $request->getPost('controls');
100 $itemId = (string)($controls[static::getId()] ?? '');
101 if (empty($itemId))
102 {
103 return null;
104 }
105
106 foreach ($this->getChildItems() as $item)
107 {
108 if ($item::getId() === $itemId)
109 {
110 return $item->processRequest($request, $isSelectedAllRows, $filter);
111 }
112 }
113
114 return null;
115 }
116}
if(!Loader::includeModule('catalog')) if(!AccessController::getCurrent() ->check(ActionDictionary::ACTION_PRICE_EDIT)) if(!check_bitrix_sessid()) $request
Определения catalog_reindex.php:36
processRequest(HttpRequest $request, bool $isSelectedAllRows, ?Filter $filter)
Определения groupaction.php:97
const RESET_CONTROLS
Определения actions.php:24
const DROPDOWN
Определения types.php:13
</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
$filter
Определения iblock_catalog_list.php:54
$items
Определения template.php:224