File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ public function process(array $data): array
3838 } else {
3939 $ categoryItem = [
4040 'id ' => $ item ['id ' ],
41- 'name ' => ( string ) $ item ['name ' ],
41+ 'name ' => $ this -> normalizeName (( string ) $ item ['name ' ]) ,
4242 'parent ' => $ item ['parent_id ' ],
4343 ];
4444 }
@@ -123,7 +123,7 @@ private function serializeCategoriesToSelectbox(
123123 if ($ category ['parent ' ] === $ parent ) {
124124 if (isset ($ usedIds [$ category ['id ' ]]) === false ) {
125125 $ return [$ category ['id ' ]] = [
126- 'name ' => ( string ) $ category ['name ' ],
126+ 'name ' => $ this -> normalizeName (( string ) $ category ['name ' ]) ,
127127 'level ' => $ level ,
128128 ];
129129 unset($ categories [$ catKey ]);
@@ -139,4 +139,14 @@ private function serializeCategoriesToSelectbox(
139139
140140 return $ return ;
141141 }
142+
143+
144+ private function normalizeName (string $ name ): string
145+ {
146+ if (str_starts_with ($ name , 'T:{ ' ) && class_exists ('Baraja\Localization\Translation ' )) {
147+ return (string ) (new \Baraja \Localization \Translation ($ name ));
148+ }
149+
150+ return $ name ;
151+ }
142152}
You can’t perform that action at this time.
0 commit comments