Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
converttoproductitem.php
1<?php
2
4
9use CUtil;
10
11final class ConvertToProductItem extends BaseItem
12{
13 public static function getId(): ?string
14 {
15 return 'convert_to_product';
16 }
17
18 protected function getText(): string
19 {
20 return Loc::getMessage('CATALOG_GRID_ROW_ACTIONS_CONVERT_TO_PRODUCT_TEXT');
21 }
22
23 public function getControl(array $rawFields): ?array
24 {
25 $id = (int)($rawFields['ID'] ?? 0);
26 if ($id <= 0)
27 {
28 return null;
29 }
30
31 $actionId = self::getId();
32 $data = CUtil::PhpToJSObject([
33 'id' => $id,
34 ]);
35 $confirmMessage = \CUtil::JSEscape(
36 Loc::getMessage('CATALOG_GRID_ROW_ACTIONS_CONVERT_TO_PRODUCT_CONFIRM_MESSAGE_MSGVER_1')
37 );
38
39 $confirmButtonMessage = \CUtil::JSEscape(
40 Loc::getMessage('CATALOG_GRID_ROW_ACTIONS_CONVERT_TO_PRODUCT_CONFIRM_BUTTON')
41 );
42 $backButtonMessage = \CUtil::JSEscape(
43 Loc::getMessage('CATALOG_GRID_ROW_ACTIONS_CONVERT_TO_PRODUCT_BACK_BUTTON')
44 );
45
46 $this->onclick = "IblockGridInstance.sendSmallPopupWithConfirm('{$actionId}', {$data}, '{$confirmMessage}', '{$confirmButtonMessage}', '{$backButtonMessage}')";
47
48 return parent::getControl($rawFields);
49 }
50
51 public function processRequest(HttpRequest $request): ?Result
52 {
53 $id = $request->getPost('id');
54 if (empty($id) || !is_numeric($id))
55 {
56 return null;
57 }
58 $id = (int)$id;
59
61 }
62}
static convertToProductElementList(int $iblockId, array $elementIds)
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29