Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
converttoproductgroupchild.php
1
<?php
2
3
namespace
Bitrix\Catalog\Grid\Panel\UI\Item\Group
;
4
5
use
Bitrix\Catalog\Grid\ProductAction
;
6
use Bitrix\Iblock\Grid\Panel\UI\Actions\Helpers\ItemFinder;
7
use
Bitrix\Iblock\Grid\Panel\UI\Actions\Item\ElementGroup\BaseGroupChild
;
8
use
Bitrix\Main\Filter\Filter
;
9
use
Bitrix\Main\Grid\Panel\Actions
;
10
use
Bitrix\Main\Grid\Panel\Snippet
;
11
use
Bitrix\Main\Grid\Panel\Snippet\Onchange
;
12
use
Bitrix\Main\HttpRequest
;
13
use
Bitrix\Main\Loader
;
14
use
Bitrix\Main\Localization\Loc
;
15
use
Bitrix\Main\Result
;
16
17
Loader::requireModule(
'iblock'
);
18
19
final
class
ConvertToProductGroupChild
extends
BaseGroupChild
20
{
21
use ItemFinder;
22
23
public
static
function
getId
(): string
24
{
25
return
'convert_to_product'
;
26
}
27
28
public
function
getName
(): string
29
{
30
return
Loc::getMessage
(
'CATALOG_GRID_PANEL_UI_PRODUCT_ACTION_CONVERT_TO_PRODUCT_NAME'
);
31
}
32
33
public
function
processRequest
(
HttpRequest
$request,
bool
$isSelectedAllRows, ?
Filter
$filter =
null
): ?
Result
34
{
35
$result =
new
Result
();
36
37
[$elementIds, $sectionIds] = $this->prepareItemIds($request, $isSelectedAllRows, $filter);
38
39
if
($elementIds)
40
{
41
$result->addErrors(
42
ProductAction::convertToProductElementList
($this->
getIblockId
(), $elementIds)->
getErrors
()
43
);
44
}
45
46
if
($sectionIds)
47
{
48
$result->addErrors(
49
ProductAction::convertToProductSectionList
($this->
getIblockId
(), $sectionIds)->
getErrors
()
50
);
51
}
52
53
return
$result;
54
}
55
56
protected
function
getOnchange
():
Onchange
57
{
58
$confirmMessage =
Loc::getMessage
(
'CATALOG_GRID_PANEL_UI_PRODUCT_ACTION_CONVERT_TO_PRODUCT_CONFIRM'
);
59
60
return
new
Onchange
([
61
[
62
'ACTION'
=> Actions::RESET_CONTROLS,
63
],
64
[
65
'ACTION'
=> Actions::CREATE,
66
'DATA'
=> [
67
(
new
Snippet
)->getSendSelectedButton($confirmMessage),
68
],
69
],
70
]);
71
}
72
}
Bitrix\Catalog\Grid\Panel\UI\Item\Group\ConvertToProductGroupChild
Definition
converttoproductgroupchild.php:20
Bitrix\Catalog\Grid\Panel\UI\Item\Group\ConvertToProductGroupChild\getName
getName()
Definition
converttoproductgroupchild.php:28
Bitrix\Catalog\Grid\Panel\UI\Item\Group\ConvertToProductGroupChild\processRequest
processRequest(HttpRequest $request, bool $isSelectedAllRows, ?Filter $filter=null)
Definition
converttoproductgroupchild.php:33
Bitrix\Catalog\Grid\Panel\UI\Item\Group\ConvertToProductGroupChild\getId
static getId()
Definition
converttoproductgroupchild.php:23
Bitrix\Catalog\Grid\Panel\UI\Item\Group\ConvertToProductGroupChild\getOnchange
getOnchange()
Definition
converttoproductgroupchild.php:56
Bitrix\Catalog\Grid\ProductAction
Definition
productaction.php:16
Bitrix\Catalog\Grid\ProductAction\convertToProductSectionList
static convertToProductSectionList(int $iblockId, array $sections)
Definition
productaction.php:382
Bitrix\Catalog\Grid\ProductAction\convertToProductElementList
static convertToProductElementList(int $iblockId, array $elementIds)
Definition
productaction.php:392
Bitrix\Iblock\Grid\Panel\UI\Actions\Item\ElementGroup\BaseGroupChild
Definition
basegroupchild.php:9
Bitrix\Iblock\Grid\Panel\UI\Actions\Item\ElementGroup\BaseGroupChild\getIblockId
getIblockId()
Definition
basegroupchild.php:21
Bitrix\Main\DB\Result
Definition
result.php:19
Bitrix\Main\Filter\Filter
Definition
filter.php:5
Bitrix\Main\Grid\Panel\Actions
Definition
actions.php:13
Bitrix\Main\Grid\Panel\Snippet\Onchange
Definition
onchange.php:15
Bitrix\Main\Grid\Panel\Snippet
Definition
snippet.php:19
Bitrix\Main\HttpRequest
Definition
httprequest.php:20
Bitrix\Main\Loader
Definition
loader.php:12
Bitrix\Main\Localization\Loc
Definition
loc.php:11
Bitrix\Main\Localization\Loc\getMessage
static getMessage($code, $replace=null, $language=null)
Definition
loc.php:29
Bitrix\Main\ORM\Data\Result
Definition
result.php:16
Bitrix\Catalog\Grid\Panel\UI\Item\Group
Definition
changepricesgroupchild.php:3
Bitrix\Main\Grid\Panel\Snippet
Definition
button.php:3
Bitrix\Main\getErrors
getErrors()
Definition
errorableimplementation.php:34
modules
catalog
lib
grid
panel
ui
item
group
converttoproductgroupchild.php
Создано системой
1.10.0