We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a0c0f08 commit e11170aCopy full SHA for e11170a
src/SelectboxTree.php
@@ -34,14 +34,19 @@ public function process(array $data): array
34
$categories = [];
35
foreach ($data as $item) {
36
if ($item instanceof SelectboxItem) {
37
- $categories[] = $item;
+ $categoryItem = $item;
38
} else {
39
- $categories[] = [
+ $categoryItem = [
40
'id' => $item['id'],
41
- 'name' => $this->nameFormatter === null ? (string) $item['name'] : $this->nameFormatter->format($item['name']),
+ 'name' => (string) $item['name'],
42
'parent' => $item['parent_id'],
43
];
44
}
45
+ if ($this->nameFormatter !== null) {
46
+ $categoryItem['name'] = $this->nameFormatter->format($categoryItem['name']);
47
+ }
48
+
49
+ $categories[] = $categoryItem;
50
51
52
$return = [];
0 commit comments