Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
converttoserviceitem.php
1<?php
2
4
9use CUtil;
10
11final class ConvertToServiceItem extends BaseItem
12{
13 public static function getId(): ?string
14 {
15 return 'convert_to_service';
16 }
17
18 protected function getText(): string
19 {
20 return Loc::getMessage('CATALOG_GRID_ROW_ACTIONS_CONVERT_TO_SERVICE_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 $confirmMessageTitle = \CUtil::JSEscape(
36 Loc::getMessage('CATALOG_GRID_ROW_ACTIONS_CONVERT_TO_SERVICE_CONFIRM_MESSAGE_TITLE')
37 );
38 $confirmMessageContent = \CUtil::JSEscape(
39 Loc::getMessage('CATALOG_GRID_ROW_ACTIONS_CONVERT_TO_SERVICE_CONFIRM_MESSAGE_CONTENT')
40 );
41
42 $confirmButtonMessage = \CUtil::JSEscape(
43 Loc::getMessage('CATALOG_GRID_ROW_ACTIONS_CONVERT_TO_SERVICE_CONFIRM_BUTTON')
44 );
45 $backButtonMessage = \CUtil::JSEscape(
46 Loc::getMessage('CATALOG_GRID_ROW_ACTIONS_CONVERT_TO_SERVICE_BACK_BUTTON')
47 );
48
49 $this->onclick = "IblockGridInstance.sendMediumPopupWithConfirm("
50 . "'{$actionId}', "
51 . "{$data}, "
52 . "'{$confirmMessageTitle}', "
53 . "'{$confirmMessageContent}', "
54 . "'{$confirmButtonMessage}', "
55 . "'{$backButtonMessage}')"
56 ;
57
58 return parent::getControl($rawFields);
59 }
60
61 public function processRequest(HttpRequest $request): ?Result
62 {
63 $id = $request->getPost('id');
64 if (empty($id) || !is_numeric($id))
65 {
66 return null;
67 }
68 $id = (int)$id;
69
71 }
72}
static convertToServiceElementList(int $iblockId, array $elementIds)
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29