Skip to content

Commit 93793d8

Browse files
committed
Grid Export rendered data is not reflecting in the exported File, Displayed ID instead of Rendered Label #25963.
Implemented strict types.
1 parent b43980b commit 93793d8

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

app/code/Magento/Ui/Model/Export/MetadataProvider.php

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
67

78
namespace Magento\Ui\Model\Export;
89

@@ -83,10 +84,11 @@ public function __construct(
8384
* Returns Columns component
8485
*
8586
* @param UiComponentInterface $component
87+
*
8688
* @return UiComponentInterface
8789
* @throws Exception
8890
*/
89-
protected function getColumnsComponent(UiComponentInterface $component)
91+
protected function getColumnsComponent(UiComponentInterface $component): UiComponentInterface
9092
{
9193
foreach ($component->getChildComponents() as $childComponent) {
9294
if ($childComponent instanceof Columns) {
@@ -104,7 +106,7 @@ protected function getColumnsComponent(UiComponentInterface $component)
104106
* @return UiComponentInterface[]
105107
* @throws Exception
106108
*/
107-
protected function getColumns(UiComponentInterface $component)
109+
protected function getColumns(UiComponentInterface $component): array
108110
{
109111
if (!isset($this->columns[$component->getName()])) {
110112
$columns = $this->getColumnsComponent($component);
@@ -114,6 +116,7 @@ protected function getColumns(UiComponentInterface $component)
114116
}
115117
}
116118
}
119+
117120
return $this->columns[$component->getName()];
118121
}
119122

@@ -125,7 +128,7 @@ protected function getColumns(UiComponentInterface $component)
125128
* @return string[]
126129
* @throws Exception
127130
*/
128-
public function getHeaders(UiComponentInterface $component)
131+
public function getHeaders(UiComponentInterface $component): array
129132
{
130133
$row = [];
131134
foreach ($this->getColumns($component) as $column) {
@@ -140,15 +143,16 @@ public function getHeaders(UiComponentInterface $component)
140143
*
141144
* @param UiComponentInterface $component
142145
*
143-
* @return array
146+
* @return string[]
144147
* @throws Exception
145148
*/
146-
public function getFields(UiComponentInterface $component)
149+
public function getFields(UiComponentInterface $component): array
147150
{
148151
$row = [];
149152
foreach ($this->getColumns($component) as $column) {
150153
$row[] = $column->getName();
151154
}
155+
152156
return $row;
153157
}
154158

@@ -158,9 +162,10 @@ public function getFields(UiComponentInterface $component)
158162
* @param DocumentInterface $document
159163
* @param array $fields
160164
* @param array $options
161-
* @return array
165+
*
166+
* @return string[]
162167
*/
163-
public function getRowData(DocumentInterface $document, $fields, $options)
168+
public function getRowData(DocumentInterface $document, $fields, $options): array
164169
{
165170
$row = [];
166171
foreach ($fields as $column) {
@@ -175,6 +180,7 @@ public function getRowData(DocumentInterface $document, $fields, $options)
175180
$row[] = $document->getCustomAttribute($column)->getValue();
176181
}
177182
}
183+
178184
return $row;
179185
}
180186

@@ -184,9 +190,10 @@ public function getRowData(DocumentInterface $document, $fields, $options)
184190
* @param array $list
185191
* @param string $label
186192
* @param array $output
193+
*
187194
* @return void
188195
*/
189-
protected function getComplexLabel($list, $label, &$output)
196+
protected function getComplexLabel($list, $label, &$output): void
190197
{
191198
foreach ($list as $item) {
192199
if (!is_array($item['value'])) {
@@ -228,7 +235,7 @@ protected function getOptionsArray(array $options): array
228235
* @return array
229236
* @throws LocalizedException
230237
*/
231-
public function getOptions()
238+
public function getOptions(): array
232239
{
233240
return array_merge(
234241
$this->getColumnOptions(),
@@ -243,7 +250,7 @@ public function getOptions()
243250
* @throws LocalizedException
244251
* @throws Exception
245252
*/
246-
protected function getColumnOptions()
253+
protected function getColumnOptions(): array
247254
{
248255
$options = [];
249256
$component = $this->filter->getComponent();
@@ -264,7 +271,7 @@ protected function getColumnOptions()
264271
* @return array
265272
* @throws LocalizedException
266273
*/
267-
protected function getFilterOptions()
274+
protected function getFilterOptions(): array
268275
{
269276
$options = [];
270277
$component = $this->filter->getComponent();
@@ -279,6 +286,7 @@ protected function getFilterOptions()
279286
}
280287
}
281288
}
289+
282290
return $options;
283291
}
284292

@@ -287,10 +295,11 @@ protected function getFilterOptions()
287295
*
288296
* @param DocumentInterface $document
289297
* @param string $componentName
298+
*
290299
* @return void
291300
* @throws Exception
292301
*/
293-
public function convertDate($document, $componentName)
302+
public function convertDate($document, $componentName): void
294303
{
295304
if (!isset($this->data[$componentName])) {
296305
return;

0 commit comments

Comments
 (0)