Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
serviceform.php
1<?php
2
4
9
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 {
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 {
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}
getPropertyDescription(Property $property)
getAdditionalValues(array $values, array $descriptions=[])
static signParameters($componentName, $parameters)
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29