Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
serviceform.php
1
<?php
2
3
namespace
Bitrix\Catalog\Component
;
4
5
use
Bitrix\Catalog\v2\IoC\ServiceContainer
;
6
use
Bitrix\Catalog\v2\Property\Property
;
7
use
Bitrix\Main\Component\ParameterSigner
;
8
use
Bitrix\Main\Localization\Loc
;
9
10
class
ServiceForm
extends
ProductForm
11
{
12
protected
const
GRID_SIGNED_PARAMETERS_NAME
=
'SERVICE_GRID_SIGNED_PARAMETERS'
;
13
15
protected
$entity
;
16
17
protected
function
getVariationGridShortComponentName
(): string
18
{
19
return
'catalog.productcard.service.grid'
;
20
}
21
22
protected
function
getGridController
(): array
23
{
24
return
[
25
'name'
=>
'SERVICE_GRID_CONTROLLER'
,
26
'type'
=>
'service_grid'
,
27
'config'
=> [
28
'reloadUrl'
=>
'/bitrix/components/bitrix/'
. $this->
getVariationGridShortComponentName
() .
'/list.ajax.php'
,
29
'signedParameters'
=> $this->
getVariationGridSignedParameters
(),
30
'gridId'
=> $this->
getVariationGridId
(),
31
],
32
];
33
}
34
35
protected
function
getGridFieldConfig
(): array
36
{
37
return
[
38
'name'
=>
'service_grid'
,
39
'title'
=>
'service_grid'
,
40
'type'
=>
'included_area'
,
41
'data'
=> [
42
'isRemovable'
=>
false
,
43
'type'
=>
'component'
,
44
'componentName'
=> $this->
getVariationGridComponentName
(),
45
'action'
=>
'getProductGrid'
,
46
'mode'
=>
'ajax'
,
47
'signedParametersName'
=> static::GRID_SIGNED_PARAMETERS_NAME,
48
],
49
'sort'
=> 100,
50
];
51
}
52
53
protected
function
getCatalogParametersSectionConfig
(): array
54
{
55
return
[];
56
}
57
58
protected
function
getVariationGridParameters
(): array
59
{
60
return
[
61
'IBLOCK_ID'
=> $this->entity->getIblockId(),
62
'PRODUCT_ID'
=> $this->entity->getId(),
63
'PRODUCT_TYPE_ID'
=> $this->entity->getType(),
64
'COPY_PRODUCT_ID'
=> $this->params[
'COPY_PRODUCT_ID'
] ??
null
,
65
'EXTERNAL_FIELDS'
=> $this->params[
'EXTERNAL_FIELDS'
] ??
null
,
66
'PATH_TO'
=> $this->params[
'PATH_TO'
] ?? [],
67
];
68
}
69
70
protected
function
getVariationGridSignedParameters
(): string
71
{
72
return
ParameterSigner::signParameters
(
73
$this->
getVariationGridComponentName
(),
74
$this->
getVariationGridParameters
()
75
);
76
}
77
78
public
function
getVariationGridId
(): string
79
{
80
$iblockInfo = ServiceContainer::getIblockInfo($this->entity->getIblockId());
81
82
if
($iblockInfo)
83
{
84
return
'catalog-product-service-grid-'
. $iblockInfo->getProductIblockId();
85
}
86
87
return
'catalog-product-service-grid'
;
88
}
89
90
public
function
getVariationGridClassName
(): string
91
{
92
return
GridServiceForm::class;
93
}
94
95
protected
function
getCardSettingsItems
(): array
96
{
97
return
GridServiceForm::getGridCardSettingsItems
();
98
}
99
100
protected
function
getPropertyDescription
(
Property
$property): array
101
{
102
$description = parent::getPropertyDescription($property);
103
if
($property->
getCode
() ===
BaseForm::MORE_PHOTO
)
104
{
105
$description[
'title'
] =
Loc::getMessage
(
'CATALOG_SERVICE_FORM_PROPERTY_NAME_MORE_PHOTO'
);
106
}
107
108
return
$description;
109
}
110
111
public
function
getCardConfigId
(): string
112
{
113
$iblockInfo = ServiceContainer::getIblockInfo($this->entity->getIblockId());
114
115
if
($iblockInfo)
116
{
117
return
'catalog-service-card-config-'
. $iblockInfo->getProductIblockId();
118
}
119
120
return
'catalog-service-card-config'
;
121
}
122
123
public
function
getVariationGridJsComponentName
(): string
124
{
125
return
'BX.Catalog.ProductServiceGrid'
;
126
}
127
128
protected
function
showSpecificCatalogParameters
(): bool
129
{
130
return
false
;
131
}
132
133
protected
function
getAdditionalValues
(array $values, array
$descriptions
= []): array
134
{
135
$result = parent::getAdditionalValues($values,
$descriptions
);
136
137
$result[static::GRID_SIGNED_PARAMETERS_NAME] = $this->
getVariationGridSignedParameters
();
138
unset($result[
'VARIATION_GRID_SIGNED_PARAMETERS'
]);
139
140
return
$result;
141
}
142
}
Bitrix\Catalog\Component\BaseForm\MORE_PHOTO
const MORE_PHOTO
Definition
baseform.php:53
Bitrix\Catalog\Component\BaseForm\$descriptions
array $descriptions
Definition
baseform.php:77
Bitrix\Catalog\Component\GridServiceForm\getGridCardSettingsItems
static getGridCardSettingsItems()
Definition
gridserviceform.php:158
Bitrix\Catalog\Component\ProductForm
Definition
productform.php:14
Bitrix\Catalog\Component\ProductForm\getVariationGridComponentName
getVariationGridComponentName()
Definition
productform.php:77
Bitrix\Catalog\Component\ServiceForm
Definition
serviceform.php:11
Bitrix\Catalog\Component\ServiceForm\getVariationGridSignedParameters
getVariationGridSignedParameters()
Definition
serviceform.php:70
Bitrix\Catalog\Component\ServiceForm\getPropertyDescription
getPropertyDescription(Property $property)
Definition
serviceform.php:100
Bitrix\Catalog\Component\ServiceForm\getCardSettingsItems
getCardSettingsItems()
Definition
serviceform.php:95
Bitrix\Catalog\Component\ServiceForm\showSpecificCatalogParameters
showSpecificCatalogParameters()
Definition
serviceform.php:128
Bitrix\Catalog\Component\ServiceForm\getVariationGridId
getVariationGridId()
Definition
serviceform.php:78
Bitrix\Catalog\Component\ServiceForm\getVariationGridShortComponentName
getVariationGridShortComponentName()
Definition
serviceform.php:17
Bitrix\Catalog\Component\ServiceForm\getCardConfigId
getCardConfigId()
Definition
serviceform.php:111
Bitrix\Catalog\Component\ServiceForm\getGridController
getGridController()
Definition
serviceform.php:22
Bitrix\Catalog\Component\ServiceForm\$entity
$entity
Definition
serviceform.php:15
Bitrix\Catalog\Component\ServiceForm\getVariationGridJsComponentName
getVariationGridJsComponentName()
Definition
serviceform.php:123
Bitrix\Catalog\Component\ServiceForm\getAdditionalValues
getAdditionalValues(array $values, array $descriptions=[])
Definition
serviceform.php:133
Bitrix\Catalog\Component\ServiceForm\getGridFieldConfig
getGridFieldConfig()
Definition
serviceform.php:35
Bitrix\Catalog\Component\ServiceForm\getVariationGridClassName
getVariationGridClassName()
Definition
serviceform.php:90
Bitrix\Catalog\Component\ServiceForm\getCatalogParametersSectionConfig
getCatalogParametersSectionConfig()
Definition
serviceform.php:53
Bitrix\Catalog\Component\ServiceForm\GRID_SIGNED_PARAMETERS_NAME
const GRID_SIGNED_PARAMETERS_NAME
Definition
serviceform.php:12
Bitrix\Catalog\Component\ServiceForm\getVariationGridParameters
getVariationGridParameters()
Definition
serviceform.php:58
Bitrix\Catalog\v2\IoC\ServiceContainer
Definition
ServiceContainer.php:22
Bitrix\Catalog\v2\Property\Property
Definition
Property.php:26
Bitrix\Catalog\v2\Property\Property\getCode
getCode()
Definition
Property.php:101
Bitrix\Main\Component\ParameterSigner
Definition
parametersigner.php:11
Bitrix\Main\Component\ParameterSigner\signParameters
static signParameters($componentName, $parameters)
Definition
parametersigner.php:19
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\Catalog\Component
Definition
baseform.php:3
modules
catalog
lib
component
serviceform.php
Создано системой
1.10.0