Skip to content

Commit 1cca899

Browse files
authored
Fixes grid column type concat (#4476)
* Fixes grid column type `concat` * removed useless test
1 parent cb9305a commit 1cca899

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

app/code/core/Mage/Adminhtml/Block/Widget/Grid.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,10 @@ public function addColumnDefaultData(array $column): array
345345
{
346346
$config = $this->getConfigDefaultColumnSettings();
347347
$columnHasIndex = array_key_exists('index', $column);
348-
if ($columnHasIndex && array_key_exists($column['index'], $config['index'])) {
348+
if ($columnHasIndex &&
349+
!is_array($column['index']) &&
350+
array_key_exists($column['index'], $config['index'])
351+
) {
349352
$column += $config['index'][$column['index']];
350353
}
351354

app/code/core/Mage/Adminhtml/etc/config.xml

+3
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,9 @@
267267
<sortable>false</sortable>
268268
<width>40</width>
269269
</action>
270+
<concat>
271+
<separator> </separator>
272+
</concat>
270273
<currency>
271274
<align>right</align>
272275
<index>price</index>

tests/unit/Mage/Adminhtml/Block/Widget/GridTest.php

+11
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,17 @@ public function provideAddColumnDefaultData(): Generator
7272
'type' => 'text',
7373
],
7474
];
75+
yield 'index array - ref #4475' => [
76+
[
77+
'index' => ['firstname', 'lastname'],
78+
'type' => 'concat',
79+
'separator' => ' ',
80+
],
81+
[
82+
'index' => ['firstname', 'lastname'],
83+
'type' => 'concat',
84+
],
85+
];
7586
yield 'type action' => [
7687
[
7788
'type' => 'action',

0 commit comments

Comments
 (0)