|
19 | 19 | */ |
20 | 20 | class CmsPageDataProvider |
21 | 21 | { |
22 | | - /** |
23 | | - * @var ServiceOutputProcessor |
24 | | - */ |
25 | | - private $serviceOutputProcessor; |
26 | | - |
27 | | - /** |
28 | | - * @var SerializerInterface |
29 | | - */ |
30 | | - private $jsonSerializer; |
31 | | - |
32 | 22 | /** |
33 | 23 | * @var CmsPageRepositoryInterface |
34 | 24 | */ |
35 | 25 | private $cmsPageRepository; |
36 | 26 |
|
37 | 27 | /** |
38 | 28 | * @param CmsPageRepositoryInterface $cmsPageRepository |
39 | | - * @param ServiceOutputProcessor $serviceOutputProcessor |
40 | | - * @param SerializerInterface $jsonSerializer |
41 | 29 | */ |
42 | 30 | public function __construct( |
43 | | - CmsPageRepositoryInterface $cmsPageRepository, |
44 | | - ServiceOutputProcessor $serviceOutputProcessor, |
45 | | - SerializerInterface $jsonSerializer |
| 31 | + CmsPageRepositoryInterface $cmsPageRepository |
46 | 32 | ) { |
47 | | - $this->serviceOutputProcessor = $serviceOutputProcessor; |
48 | | - $this->jsonSerializer = $jsonSerializer; |
49 | 33 | $this->cmsPageRepository = $cmsPageRepository; |
50 | 34 | } |
51 | 35 |
|
@@ -92,54 +76,6 @@ private function processCmsPage(CmsPageInterface $cmsPageModel) : array |
92 | 76 | 'mate_keywords' => $cmsPageModel->getMetaKeywords(), |
93 | 77 | ]; |
94 | 78 |
|
95 | | - if (isset($cmsPageData['extension_attributes'])) { |
96 | | - $cmsPageData = array_merge($cmsPageData, $cmsPageData['extension_attributes']); |
97 | | - } |
98 | | - |
99 | | - if (isset($cmsPageData['custom_attributes'])) { |
100 | | - $cmsPageData = array_merge($cmsPageData, $this->processCustomAttributes($cmsPageData['custom_attributes'])); |
101 | | - } |
102 | | - |
103 | 79 | return $cmsPageData; |
104 | 80 | } |
105 | | - |
106 | | - /** |
107 | | - * @param array $customAttributes |
108 | | - * |
109 | | - * @return array |
110 | | - */ |
111 | | - private function processCustomAttributes(array $customAttributes) : array |
112 | | - { |
113 | | - $processedCustomAttributes = []; |
114 | | - |
115 | | - foreach ($customAttributes as $customAttribute) { |
116 | | - $isArray = false; |
117 | | - $customAttributeCode = $customAttribute['attribute_code']; |
118 | | - $customAttributeValue = $customAttribute['attribute_code']; |
119 | | - |
120 | | - if (is_array($customAttributeValue)) { |
121 | | - $isArray = true; |
122 | | - |
123 | | - foreach ($customAttributeValue as $attributeValue) { |
124 | | - if (is_array($attributeValue)) { |
125 | | - $processedCustomAttributes[$customAttributeCode] = $this->jsonSerializer->serialize( |
126 | | - $customAttributeValue |
127 | | - ); |
128 | | - continue; |
129 | | - } |
130 | | - $processedCustomAttributes[$customAttributeCode] = implode(',', $customAttributeValue); |
131 | | - continue; |
132 | | - } |
133 | | - } |
134 | | - |
135 | | - if ($isArray) { |
136 | | - continue; |
137 | | - } |
138 | | - |
139 | | - $processedCustomAttributes[$customAttributeCode] = $customAttributeValue; |
140 | | - } |
141 | | - |
142 | | - return $processedCustomAttributes; |
143 | | - } |
144 | | - |
145 | 81 | } |
0 commit comments