1515
1616namespace ApacheSolrForTypo3 \Solr \Backend ;
1717
18+ use ApacheSolrForTypo3 \Solr \ConnectionManager ;
1819use ApacheSolrForTypo3 \Solr \Domain \Site \Site ;
1920use TYPO3 \CMS \Backend \Form \Exception as BackendFormException ;
2021use TYPO3 \CMS \Backend \Form \FormResultCompiler ;
@@ -130,10 +131,9 @@ public function render(): string
130131 protected function getLanguageUidCoreMap (): array
131132 {
132133 $ coreTableMap = [];
133- $ cores = $ this ->site ->getAllSolrConnectionConfigurations ();
134- foreach ($ cores as $ languageUid => $ core ) {
135- $ corePath = $ core ['write ' ]['path ' ];
136- $ coreTableMap [$ languageUid ] = $ corePath ;
134+ $ solrServers = GeneralUtility::makeInstance (ConnectionManager::class)->getConnectionsBySite ($ this ->site );
135+ foreach ($ solrServers as $ languageUid => $ solrConnection ) {
136+ $ coreTableMap [$ languageUid ] = $ solrConnection ->getWriteService ()->getCorePath ();
137137 }
138138 return $ coreTableMap ;
139139 }
@@ -149,10 +149,13 @@ protected function buildSelectorItems(array $coresToOptimize): array
149149 {
150150 $ selectorItems = [];
151151
152- foreach ($ coresToOptimize as $ corePath ) {
153- $ icon = 'module-searchbackend_SolrCoreoptimization ' ;
152+ foreach ($ coresToOptimize as $ systemLanguageId => $ corePath ) {
154153 $ corePath = rtrim ($ corePath , '/ ' );
155- $ selectorItems [] = [$ corePath , $ corePath , $ icon ];
154+ $ selectorItems [] = [
155+ $ corePath ,
156+ $ corePath ,
157+ $ this ->getFlagIdentifierForSystemLanguageId ($ systemLanguageId ),
158+ ];
156159 }
157160
158161 return $ selectorItems ;
@@ -173,22 +176,36 @@ protected function renderSelectCheckbox(array $items, array $selectedValues): st
173176 'itemFormElValue ' => $ selectedValues ,
174177 'fieldConf ' => ['config ' => ['items ' => $ items ]],
175178 'fieldTSConfig ' => ['noMatchingValue_label ' => '' ],
179+ 'itemFormElID ' => '' ,
176180 ];
177181
178182 $ nodeFactory = GeneralUtility::makeInstance (NodeFactory::class);
179183 $ options = [
184+ 'type ' => 'select ' ,
180185 'renderType ' => 'selectCheckBox ' ,
181- 'table ' => 'tx_solr_classes_backend_coreselector ' ,
186+ 'tableName ' => 'tx_solr_classes_backend_coreselector ' ,
182187 'fieldName ' => 'additionalFields ' ,
183- 'databaseRow ' => [],
188+ 'databaseRow ' => [' uid ' => 0 ],
184189 'parameterArray ' => $ parameterArray ,
190+ 'processedTca ' => ['columns ' => ['additionalFields ' => ['config ' => ['type ' => 'select ' ]]]],
185191 ];
186192
187- $ selectCheckboxResult = $ nodeFactory ->create ($ options )->render ();
193+ $ selectCheckboxResult = $ nodeFactory
194+ ->create ($ options )
195+ ->render ();
188196 $ formResultCompiler = GeneralUtility::makeInstance (FormResultCompiler::class);
189197 $ formResultCompiler ->mergeResult ($ selectCheckboxResult );
190198
191199 $ formHtml = $ selectCheckboxResult ['html ' ] ?? '' ;
192200 return $ formResultCompiler ->addCssFiles () . $ formHtml . $ formResultCompiler ->printNeededJSFunctions ();
193201 }
202+
203+ protected function getFlagIdentifierForSystemLanguageId ($ systemLanguageId ): string
204+ {
205+ $ flagIdentifier = $ this ->site ->getTypo3SiteObject ()->getLanguageById ((int )$ systemLanguageId )->getFlagIdentifier ();
206+ if (!empty ($ flagIdentifier )) {
207+ return $ flagIdentifier ;
208+ }
209+ return 'flags-multiple ' ;
210+ }
194211}
0 commit comments