Skip to content

Commit

Permalink
Merge pull request #28 from pagemachine/typo3v10-extension-configuration
Browse files Browse the repository at this point in the history
Use new extension configuration if available
  • Loading branch information
mbrodala authored Jan 11, 2021
2 parents d49f937 + 8a61a69 commit 4bb28f0
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
31 changes: 22 additions & 9 deletions ext_localconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,20 +89,33 @@
],
];

//Load Extension Manager settings
if (!empty($_EXTCONF)) {
$typoScriptService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\TypoScript\TypoScriptService::class);
$extensionManagementConfig = $typoScriptService->convertTypoScriptArrayToPlainArray(unserialize($_EXTCONF));
unset($typoScriptService);
// Load Extension Manager settings
(function (): void {
$extensionConfiguration = [];

foreach ($extensionManagementConfig as $key => $value) {
if (class_exists(\TYPO3\CMS\Core\Configuration\ExtensionConfiguration::class)) {
try {
$extensionConfiguration = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Configuration\ExtensionConfiguration::class)
->get('searchable');
} catch (\TYPO3\CMS\Core\Configuration\Exception\ExtensionConfigurationExtensionNotConfiguredException $e) {
$extensionConfiguration = [];
}
} elseif (!empty($_EXTCONF)) {
$extensionConfiguration = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\TypoScript\TypoScriptService::class)
->convertTypoScriptArrayToPlainArray(unserialize($_EXTCONF));
}

foreach ($extensionConfiguration as $key => $value) {
if (is_array($value) && isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['searchable']['extensionManagement'][$key])) {
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['searchable']['extensionManagement'][$key] = array_merge($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['searchable']['extensionManagement'][$key], $extensionManagementConfig[$key]);
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['searchable']['extensionManagement'][$key] = array_merge(
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['searchable']['extensionManagement'][$key],
$extensionConfiguration[$key]
);
} else {
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['searchable']['extensionManagement'][$key] = $extensionManagementConfig[$key];
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['searchable']['extensionManagement'][$key] = $extensionConfiguration[$key];
}
}
}
})();

//Register eid
$GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['searchable_autosuggest'] = \PAGEmachine\Searchable\Eid\Autosuggest::class . '::processRequest';
Expand Down
4 changes: 4 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ parameters:
ignoreErrors:
- message: '#Variable \$_EXTKEY might not be defined.#'
path: ext_emconf.php
- message: '#Undefined variable: \$_EXTCONF#'
path: ext_localconf.php
- message: '#TYPO3\\CMS\\Core\\Configuration\\Exception\\ExtensionConfigurationExtensionNotConfiguredException#'
path: ext_localconf.php
- message: '#Psr\\Http\\Server\\MiddlewareInterface#'
path: Classes/Middleware/UriBuilder.php
- message: '#TYPO3\\CMS\\Core\\Context\\.+#'
Expand Down

0 comments on commit 4bb28f0

Please sign in to comment.