Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
activateelementitem.php
1<?php
2
4
5use Bitrix\Iblock\Grid\Row\Actions\Item\Helpers\ChangeActiveHandler;
7use CUtil;
8
9final class ActivateElementItem extends BaseItem
10{
11 use ChangeActiveHandler;
12
13 protected function getSetActiveValue(): string
14 {
15 return 'Y';
16 }
17
18 public static function getId(): ?string
19 {
20 return 'activate_element';
21 }
22
23 protected function getText(): string
24 {
25 return Loc::getMessage('IBLOCK_GRID_ROW_ACTIONS_ACTIVE_ELEMENT_NAME');
26 }
27
28 public function getControl(array $rawFields): ?array
29 {
30 $id = (int)($rawFields['ID'] ?? 0);
31 if ($id <= 0)
32 {
33 return null;
34 }
35
36 $actionId = self::getId();
37 $data = CUtil::PhpToJSObject([
38 'id' => $id,
39 ]);
40
41 $this->onclick = "IblockGridInstance.sendRowAction('{$actionId}', {$data})";
42
43 return parent::getControl($rawFields);
44 }
45}
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29