2323use ApacheSolrForTypo3 \Solr \System \Configuration \TypoScriptConfiguration ;
2424use ApacheSolrForTypo3 \Solr \System \Solr \SolrConnection ;
2525use Doctrine \DBAL \Exception as DBALException ;
26+ use TYPO3 \CMS \Core \Http \ServerRequest ;
2627use TYPO3 \CMS \Core \Utility \GeneralUtility ;
28+ use TYPO3 \CMS \Extbase \Configuration \ConfigurationManager ;
2729use TYPO3 \CMS \Extbase \Configuration \ConfigurationManagerInterface ;
30+ use TYPO3 \CMS \Extbase \Configuration \Exception \InvalidConfigurationTypeException ;
2831use TYPO3 \CMS \Extbase \Utility \LocalizationUtility ;
2932
3033use function str_starts_with ;
@@ -39,6 +42,7 @@ class FlexFormUserFunctions
3942 *
4043 * @throws NoSolrConnectionFoundException
4144 * @throws DBALException
45+ * @throws InvalidConfigurationTypeException
4246 */
4347 public function getFacetFieldsFromSchema (array &$ parentInformation ): void
4448 {
@@ -99,6 +103,8 @@ protected function getParsedSolrFieldsFromSchema(array $configuredFacets, array
99103
100104 /**
101105 * Retrieves the configured facets for a page.
106+ *
107+ * @throws InvalidConfigurationTypeException
102108 */
103109 protected function getConfiguredFacetsForPage (?int $ pid = null ): ?array
104110 {
@@ -141,6 +147,8 @@ protected function getFieldNamesFromSolrMetaDataForPage(array $pageRecord): arra
141147
142148 /**
143149 * Enriches the parents information with information from template
150+ *
151+ * @throws InvalidConfigurationTypeException
144152 */
145153 public function getAvailableTemplates (array &$ parentInformation ): void
146154 {
@@ -191,21 +199,30 @@ protected function getTypoScriptTemplateKeyFromFieldName(array $parentInformatio
191199
192200 /**
193201 * Returns TypoScriptConfiguration if is available or can be resolved for given pid
202+ *
203+ * @throws InvalidConfigurationTypeException
194204 */
195205 protected function getConfigurationFromPageId (?int $ pid = null ): ?TypoScriptConfiguration
196206 {
197207 if ($ pid === null ) {
198208 return null ;
199209 }
200210
211+ /** @var ConfigurationManager $configurationManager */
201212 $ configurationManager = GeneralUtility::makeInstance (ConfigurationManagerInterface::class);
213+
214+ $ request = (new ServerRequest ())->withQueryParams (['id ' => $ pid ]);
215+ /** @noinspection PhpInternalEntityUsedInspection */
216+ $ configurationManager ->setRequest ($ request );
202217 $ typoScript = $ configurationManager ->getConfiguration (ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT );
203218
204219 return GeneralUtility::makeInstance (TypoScriptConfiguration::class, $ typoScript );
205220 }
206221
207222 /**
208223 * Retrieves the configured templates from TypoScript.
224+ *
225+ * @throws InvalidConfigurationTypeException
209226 */
210227 protected function getAvailableTemplateFromTypoScriptConfiguration (int $ pageId , string $ templateKey ): array
211228 {
0 commit comments