[BUGFIX] Adapt suggest options to 8 LTS 84/54684/3
authorStanislas Rolland <typo3@sjbr.ca>
Sun, 19 Nov 2017 16:24:22 +0000 (11:24 -0500)
committerStanislas Rolland <typo3@sjbr.ca>
Sun, 19 Nov 2017 17:03:32 +0000 (18:03 +0100)
Suggest wizard was modified in 8 LTS, dropped for select fields.
Language packs will need to be re-created.

Change-Id: I931a8bc04e619cca9c7a86097b6a315ef534d365
Resolves: #83033
Reviewed-on: https://review.typo3.org/54684
Reviewed-by: Stanislas Rolland <typo3@sjbr.ca>
Tested-by: Stanislas Rolland <typo3@sjbr.ca>
12 files changed:
ChangeLog
Classes/Domain/Repository/LanguagePackRepository.php
Classes/Hook/Backend/Form/FormDataProvider/SuggestLabelProcessor.php [new file with mode: 0644]
Classes/Hook/Backend/Form/FormDataProvider/TcaLabelProcessor.php
Classes/Hook/Backend/Recordlist/BuildQueryParameters.php [new file with mode: 0644]
Configuration/PageTSconfig/Suggest.tsconfig [new file with mode: 0644]
Configuration/TCA/Overrides/static_countries.php [new file with mode: 0644]
Configuration/TCA/Overrides/sys_language.php
Configuration/TCA/static_countries.php
Resources/Private/LanguagePackTemplate/Configuration/PageTSconfig/Suggest.tsconfig [new file with mode: 0644]
Resources/Private/LanguagePackTemplate/ext_localconf.php
ext_localconf.php

index 1547051..52c09af 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2017-11-19  Stanislas Rolland  <typo3(arobas)sjbr.ca>
+
+       * Resolves #83033: Adapt suggest options to 8 LTS
+
 2017-10-16  Stanislas Rolland  <typo3(arobas)sjbr.ca>
 
        * Resolves #82779: Corrections to official and English names of Swiss cantons - Thanks to Urs Bräm
index 0e80bb3..36c3378 100644 (file)
@@ -78,12 +78,18 @@ class LanguagePackRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
                if (!is_dir($languagePackExtensionPath . 'Configuration/TCA/Overrides/')) {
                        GeneralUtility::mkdir_deep($languagePackExtensionPath, 'Configuration/TCA/Overrides/');
                }
+               if (!is_dir($languagePackExtensionPath . 'Configuration/PageTSconfig/')) {
+                       GeneralUtility::mkdir_deep($languagePackExtensionPath, 'Configuration/PageTSconfig/');
+               }
                if (!is_dir($languagePackExtensionPath . 'Configuration/TypoScript/Extbase/')) {
                        GeneralUtility::mkdir_deep($languagePackExtensionPath, 'Configuration/TypoScript/Extbase/');
                }
                if (!is_dir($languagePackExtensionPath . 'Resources/Private/Language/')) {
                        GeneralUtility::mkdir_deep($languagePackExtensionPath, 'Resources/Private/Language/');
                }
+               if (!is_dir($languagePackExtensionPath . 'Resources/Public/Icons/')) {
+                       GeneralUtility::mkdir_deep($languagePackExtensionPath, 'Resources/Public/Icons/');
+               }
 
                // Get the source files of the language pack template
                $sourcePath = $extensionPath . 'Resources/Private/LanguagePackTemplate/';
diff --git a/Classes/Hook/Backend/Form/FormDataProvider/SuggestLabelProcessor.php b/Classes/Hook/Backend/Form/FormDataProvider/SuggestLabelProcessor.php
new file mode 100644 (file)
index 0000000..95125d9
--- /dev/null
@@ -0,0 +1,64 @@
+<?php
+namespace SJBR\StaticInfoTables\Hook\Backend\Form\FormDataProvider;
+
+/*
+ *  Copyright notice
+ *
+ *  (c) 2017 Stanislas Rolland <typo3(arobas)sjbr.ca>
+ *  All rights reserved
+ *
+ *  This script is part of the Typo3 project. The Typo3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ */
+
+use SJBR\StaticInfoTables\Domain\Model\Country;
+use SJBR\StaticInfoTables\Domain\Model\Currency;
+use SJBR\StaticInfoTables\Domain\Model\Language;
+use SJBR\StaticInfoTables\Domain\Model\Territory;
+use SJBR\StaticInfoTables\Utility\LocalizationUtility;
+use TYPO3\CMS\Backend\Form\Wizard\SuggestWizardDefaultReceiver;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+
+/**
+ * Processor for suggest items
+ */
+class SuggestLabelProcessor
+{
+       /**
+        * Translate label of entity in suggest selector
+        *
+        * @param array $params: table, uid, row, entry
+        * @param SuggestWizardDefaultReceiver $parentObj
+        * @return void
+        */
+       public function translateLabel(array &$params, SuggestWizardDefaultReceiver $parentObj)
+       {
+               $path = $params['entry']['path'];
+               if (mb_strlen($path, 'utf-8') > 30) {
+                       $croppedPath = '<abbr title="' . htmlspecialchars($path) . '">' .
+                               htmlspecialchars(
+                                       mb_substr($path, 0, 10, 'utf-8')
+                                               . '...'
+                                               . mb_substr($path, -20, null, 'utf-8')
+                               ) .
+                               '</abbr>';
+               } else {
+                       $croppedPath = htmlspecialchars($path);
+               }
+               $label = LocalizationUtility::translate(['uid' => $params['uid']], $params['table']);
+               $params['entry']['text'] = '<span class="suggest-label">' . $label . '</span><span class="suggest-uid">[' . $params['uid'] . ']</span><br />
+                                                               <span class="suggest-path">' . $croppedPath . '</span>';
+       }
+}
\ No newline at end of file
index cac5bb2..fe9e592 100644 (file)
@@ -27,6 +27,7 @@ use SJBR\StaticInfoTables\Domain\Model\Country;
 use SJBR\StaticInfoTables\Domain\Model\Currency;
 use SJBR\StaticInfoTables\Domain\Model\Language;
 use SJBR\StaticInfoTables\Domain\Model\Territory;
+use SJBR\StaticInfoTables\Utility\LocalizationUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 
 /**
@@ -43,7 +44,11 @@ class TcaLabelProcessor
         */
        public function addIsoCodeToLabel(&$PA)
        {
-               $PA['title'] = $PA['row'][$GLOBALS['TCA'][$PA['table']]['ctrl']['label']];
+               if (\TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getNumericTypo3Version()) < 8000000) {
+                       $PA['title'] = $PA['row'][$GLOBALS['TCA'][$PA['table']]['ctrl']['label']];
+               } else {
+                       $PA['title'] = LocalizationUtility::translate(['uid' => $PA['row']['uid']], $PA['table']);
+               }
                if (TYPO3_MODE == 'BE') {
                        /** @var $objectManager \TYPO3\CMS\Extbase\Object\ObjectManager */
                        $objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
diff --git a/Classes/Hook/Backend/Recordlist/BuildQueryParameters.php b/Classes/Hook/Backend/Recordlist/BuildQueryParameters.php
new file mode 100644 (file)
index 0000000..7a48f4c
--- /dev/null
@@ -0,0 +1,62 @@
+<?php
+namespace SJBR\StaticInfoTables\Hook\Backend\Recordlist;
+
+/*
+ *  Copyright notice
+ *
+ *  (c) 2017 Stanislas Rolland <typo3(arobas)sjbr.ca>
+ *  All rights reserved
+ *
+ *  This script is part of the Typo3 project. The Typo3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ */
+
+use TYPO3\CMS\Core\Database\Query\QueryHelper;
+use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRecordList;
+
+/**
+ * Order records according to language field of current language
+ */
+class BuildQueryParameters
+{
+       /**
+        * Specify records order
+        *
+        * @param array $parameters
+        * @param string $table
+        * @param int $pageId
+        * @param string $additionalConstraints
+        * @param string $fieldList
+        * @param AbstractDatabaseRecordList $parentObj
+        * @return void
+        */
+       public function buildQueryParametersPostProcess(&$parameters, $table, $pageId, $additionalConstraints, $fieldList, AbstractDatabaseRecordList $parentObj)
+       {
+               if (in_array($table, array_keys($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['static_info_tables']['tables']))) {
+                       $lang = substr(strtolower($this->getLanguageService()->lang), 0, 2);
+                       if (ExtensionManagementUtility::isLoaded('static_info_tables_' . $lang)) {
+                               $orderBy = str_replace('##', $lang, $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['static_info_tables']['tables'][$table]['label_fields'][0]);
+                               $parameters['orderBy'] = QueryHelper::parseOrderBy((string)$orderBy);
+                       }
+               }
+       }
+
+       protected function getLanguageService()
+       {
+               return $GLOBALS['LANG'];
+       }
+}
\ No newline at end of file
diff --git a/Configuration/PageTSconfig/Suggest.tsconfig b/Configuration/PageTSconfig/Suggest.tsconfig
new file mode 100644 (file)
index 0000000..d925a01
--- /dev/null
@@ -0,0 +1,4 @@
+# ***************************************************************************************
+# Translate currency labels in suggestion on static_countries table
+# ***************************************************************************************
+TCEFORM.static_countries.cn_currency_uid.suggest.default.renderFunc = SJBR\StaticInfoTables\Hook\Backend\Form\FormDataProvider\SuggestLabelProcessor->translateLabel
\ No newline at end of file
diff --git a/Configuration/TCA/Overrides/static_countries.php b/Configuration/TCA/Overrides/static_countries.php
new file mode 100644 (file)
index 0000000..1dd5d1d
--- /dev/null
@@ -0,0 +1,25 @@
+<?php
+// Use pre-8 LTS suggest options
+if (\TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getNumericTypo3Version()) < 8000000) {
+       $GLOBALS['TCA']['sys_countries']['columns']['cn_currency_uid']['config'] = [
+               'type' => 'select',
+               'renderType' => 'selectSingle',
+               'items' => array(
+                       array('', 0),
+               ),
+               'foreign_table' => 'static_currencies',
+               'foreign_table_where' => 'ORDER BY static_currencies.cu_name_en',
+               'itemsProcFunc' => 'SJBR\\StaticInfoTables\\Hook\\Backend\\Form\\FormDataProvider\\TcaSelectItemsProcessor->translateCurrenciesSelector',
+               'size' => 1,
+               'minitems' => 0,
+               'maxitems' => 1,
+               'wizards' => array(
+                       'suggest' => array(
+                               'type' => 'suggest',
+                               'default' => array(
+                                       'receiverClass' => 'SJBR\\StaticInfoTables\\Hook\\Backend\\Form\\Wizard\\SuggestReceiver'
+                               )
+                       )
+               )
+       ];
+}
\ No newline at end of file
index 2d7f5c6..804b4e7 100644 (file)
@@ -2,6 +2,7 @@
 defined('TYPO3_MODE') or die();
 
 // Configure static_lang_isocode field in TCA
+if (\TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getNumericTypo3Version()) < 8000000) {
 $GLOBALS['TCA']['sys_language']['columns']['static_lang_isocode'] = array(
        'exclude' => 1,
        'label' => 'LLL:EXT:lang/locallang_tca.xlf:sys_language.isocode',
@@ -27,5 +28,34 @@ $GLOBALS['TCA']['sys_language']['columns']['static_lang_isocode'] = array(
                )
        )
 );
+} else {
+       $GLOBALS['TCA']['sys_language']['columns']['static_lang_isocode'] = array(
+               'exclude' => 1,
+               'label' => 'LLL:EXT:lang/locallang_tca.xlf:sys_language.isocode',
+               'config' => [
+                       'type' => 'group',
+                       'internal_type' => 'db',
+                       'allowed' => 'static_languages',
+                       'foreign_table' => 'static_languages',
+                       'suggestOptions' => [
+                               'default' => [
+                                       'pidList' => '0',
+                                       'additionalSearchFields' => 'lg_name_local'
+                               ]
+                       ],
+                       'fieldWizard' => [
+                               'recordsOverview' => [
+                                       'disabled' => true
+                               ],
+                               'tableList' => [
+                                       'disabled' => true
+                               ]
+                       ],
+                       'size' => 1,
+                       'minitems' => 0,
+                       'maxitems' => 1
+               ]
+       );
+}
 
 \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes('sys_language', 'static_lang_isocode', '', 'after:language_isocode');
\ No newline at end of file
index 1907e39..7f21fc3 100644 (file)
@@ -129,31 +129,33 @@ return array(
                                'default' => ''
                        )
                ),
-               'cn_currency_uid' => array(
+               'cn_currency_uid' => [
                        'exclude' => 0,
                        'label' => 'LLL:EXT:static_info_tables/Resources/Private/Language/locallang_db.xlf:static_countries_item.cn_currency_uid',
-                       'config' => array(
-                               'type' => 'select',
-                               'renderType' => 'selectSingle',
-                               'items' => array(
-                                       array('', 0),
-                               ),
+                       'config' => [
+                               'type' => 'group',
+                               'internal_type' => 'db',
+                               'allowed' => 'static_currencies',
                                'foreign_table' => 'static_currencies',
                                'foreign_table_where' => 'ORDER BY static_currencies.cu_name_en',
-                               'itemsProcFunc' => 'SJBR\\StaticInfoTables\\Hook\\Backend\\Form\\FormDataProvider\\TcaSelectItemsProcessor->translateCurrenciesSelector',
+                               'suggestOptions' => [
+                                       'default' => [
+                                               'pidList' => '0'
+                                       ]
+                               ],
+                               'fieldWizard' => [
+                                       'recordsOverview' => [
+                                               'disabled' => true
+                                       ],
+                                       'tableList' => [
+                                               'disabled' => true
+                                       ]
+                               ],
                                'size' => 1,
                                'minitems' => 0,
-                               'maxitems' => 1,
-                               'wizards' => array(
-                                       'suggest' => array(
-                                               'type' => 'suggest',
-                                               'default' => array(
-                                                       'receiverClass' => 'SJBR\\StaticInfoTables\\Hook\\Backend\\Form\\Wizard\\SuggestReceiver'
-                                               )
-                                       )
-                               )
-                       )
-               ),
+                               'maxitems' => 1
+                       ]
+               ],
                'cn_currency_iso_nr' => array(
                        'config' => array(
                                'type' => 'passthrough',
diff --git a/Resources/Private/LanguagePackTemplate/Configuration/PageTSconfig/Suggest.tsconfig b/Resources/Private/LanguagePackTemplate/Configuration/PageTSconfig/Suggest.tsconfig
new file mode 100644 (file)
index 0000000..e26cb27
--- /dev/null
@@ -0,0 +1,9 @@
+# ***************************************************************************************
+# Translate currency labels in suggestions
+# ***************************************************************************************
+[language = *###LANG_ISO_LOWER###*]
+       TCEFORM.sys_language.static_lang_isocode.suggest.default.additionalSearchFields = lg_name_###LANG_ISO_LOWER###
+       TCEFORM.sys_language.static_lang_isocode.suggest.default.orderBy = lg_name_###LANG_ISO_LOWER###
+       TCEFORM.static_countries.cn_currency_uid.suggest.default.additionalSearchFields = cu_name_###LANG_ISO_LOWER###
+       TCEFORM.static_countries.cn_currency_uid.suggest.default.orderBy = cu_name_###LANG_ISO_LOWER###
+[global]
\ No newline at end of file
index b1851a2..93fd8cc 100644 (file)
@@ -1,4 +1,6 @@
 <?php
 defined('TYPO3_MODE') or die();
 
-\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTypoScriptSetup('<INCLUDE_TYPOSCRIPT: source="FILE:EXT:' . $_EXTKEY . '/Configuration/TypoScript/Extbase/setup.txt">');
\ No newline at end of file
+\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTypoScriptSetup('<INCLUDE_TYPOSCRIPT: source="FILE:EXT:' . $_EXTKEY . '/Configuration/TypoScript/Extbase/setup.txt">');
+// Configure translation of suggestions labels
+\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig('<INCLUDE_TYPOSCRIPT: source="FILE:EXT:' . $_EXTKEY . '/Configuration/PageTSconfig/Suggest.tsconfig">');
\ No newline at end of file
index 732fe87..59f4f12 100644 (file)
@@ -1,99 +1,92 @@
 <?php
 defined('TYPO3_MODE') or die();
 
-// Get the extensions's configuration
-$extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['static_info_tables']);
-
-// Register cache static_info_tables
-if (!is_array($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['static_info_tables'])) {
-       $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['static_info_tables'] = [];
-       $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['static_info_tables']['groups'] = ['all'];
-}
-if (!isset($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['static_info_tables']['frontend'])) {
-       $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['static_info_tables']['frontend'] = \TYPO3\CMS\Core\Cache\Frontend\PhpFrontend::class;
-}
-if (!isset($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['static_info_tables']['backend'])) {
-       $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['static_info_tables']['backend'] = \TYPO3\CMS\Core\Cache\Backend\FileBackend::class;
-}
-
-// Configure clear cache post processing for extended domain model
-$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['clearCachePostProc']['static_info_tables'] = \SJBR\StaticInfoTables\Cache\ClassCacheManager::class . '->reBuild';
-
-// Names of static entities
-$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['static_info_tables']['entities'] = ['Country', 'CountryZone', 'Currency', 'Language', 'Territory'];
-
-// Register cached domain model classes autoloader
-require_once(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('static_info_tables') . 'Classes/Cache/CachedClassLoader.php');
-\SJBR\StaticInfoTables\Cache\CachedClassLoader::registerAutoloader();
-
-// Possible label fields for different languages. Default as last.
-$labelTable = [
-       'static_territories' => [
-               'label_fields' => [
-                       'tr_name_##', 'tr_name_en',
-               ],
-               'isocode_field' => [
-                       'tr_iso_##',
-               ]
-       ],
-       'static_countries' => [
-               'label_fields' => [
-                       'cn_short_##', 'cn_short_en',
-               ],
-               'isocode_field' => [
-                       'cn_iso_##',
-               ]
-       ],
-       'static_country_zones' => [
-               'label_fields' => [
-                       'zn_name_##', 'zn_name_local',
-               ],
-               'isocode_field' => [
-                       'zn_code', 'zn_country_iso_##',
-               ]
-       ],
-       'static_languages' => [
-               'label_fields' => [
-                       'lg_name_##', 'lg_name_en',
-               ],
-               'isocode_field' => [
-                       'lg_iso_##', 'lg_country_iso_##',
-               ]
-       ],
-       'static_currencies' => [
-               'label_fields' => [
-                       'cu_name_##', 'cu_name_en',
-               ],
-               'isocode_field' => [
-                       'cu_iso_##',
-               ]
-       ]
-];
-
-if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['static_info_tables']['tables']) && is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['static_info_tables']['tables'])) {
-       $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['static_info_tables']['tables'] = array_merge($labelTable, $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['static_info_tables']['tables']);
-} else {
-       $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['static_info_tables']['tables'] = $labelTable;
-}
-
-// Add data handling hook to manage ISO codes redundancies on records
-$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'][] = \SJBR\StaticInfoTables\Hook\Core\DataHandling\ProcessDataMap::class;
-
-// Register slot for AfterExtensionInstall signal
-$dispatcher = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\SignalSlot\Dispatcher::class);
-$dispatcher->connect(\TYPO3\CMS\Extensionmanager\Utility\InstallUtility::class, 'afterExtensionInstall', \SJBR\StaticInfoTables\Slot\Extensionmanager\AfterExtensionInstall::class, 'executeUpdateScript');
-
-// Enabling the Static Info Tables Manager module
-$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['static_info_tables']['enableManager'] = isset($extConf['enableManager']) ? $extConf['enableManager'] : '0';
-
-// Make the extension version and constraints available when creating language packs and to other extensions
-$emConfUtility = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extensionmanager\Utility\EmConfUtility::class);
-$emConf = $emConfUtility->includeEmConf(['key' => 'static_info_tables', 'siteRelPath' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath('static_info_tables')]);
-$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['static_info_tables']['version'] = $emConf['static_info_tables']['version'];
-$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['static_info_tables']['constraints'] = $emConf['static_info_tables']['constraints'];
-
-unset($labelTable);
-unset($extConf);
-unset($dispatcher);
-unset($emConfUtility);
-unset($emConf);
\ No newline at end of file
+call_user_func(
+    function($extKey)
+    {
+               // Get the extensions's configuration
+               $extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$extKey]);
+               // Register cache static_info_tables
+               if (!is_array($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'][$extKey])) {
+                       $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'][$extKey] = [];
+                       $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'][$extKey]['groups'] = ['all'];
+               }
+               if (!isset($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['static_info_tables']['frontend'])) {
+                       $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'][$extKey]['frontend'] = \TYPO3\CMS\Core\Cache\Frontend\PhpFrontend::class;
+               }
+               if (!isset($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['static_info_tables']['backend'])) {
+                       $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'][$extKey]['backend'] = \TYPO3\CMS\Core\Cache\Backend\FileBackend::class;
+               }
+               // Configure clear cache post processing for extended domain model
+               $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['clearCachePostProc']['static_info_tables'] = \SJBR\StaticInfoTables\Cache\ClassCacheManager::class . '->reBuild';
+               // Names of static entities
+               $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$extKey]['entities'] = ['Country', 'CountryZone', 'Currency', 'Language', 'Territory'];
+               // Register cached domain model classes autoloader
+               require_once(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($extKey) . 'Classes/Cache/CachedClassLoader.php');
+               \SJBR\StaticInfoTables\Cache\CachedClassLoader::registerAutoloader();
+               // Possible label fields for different languages. Default as last.
+               $labelTable = [
+                       'static_territories' => [
+                               'label_fields' => [
+                                       'tr_name_##', 'tr_name_en',
+                               ],
+                               'isocode_field' => [
+                                       'tr_iso_##',
+                               ]
+                       ],
+                       'static_countries' => [
+                               'label_fields' => [
+                                       'cn_short_##', 'cn_short_en',
+                               ],
+                               'isocode_field' => [
+                                       'cn_iso_##',
+                               ]
+                       ],
+                       'static_country_zones' => [
+                               'label_fields' => [
+                                       'zn_name_##', 'zn_name_local',
+                               ],
+                               'isocode_field' => [
+                                       'zn_code', 'zn_country_iso_##',
+                               ]
+                       ],
+                       'static_languages' => [
+                               'label_fields' => [
+                                       'lg_name_##', 'lg_name_en',
+                               ],
+                               'isocode_field' => [
+                                       'lg_iso_##', 'lg_country_iso_##',
+                               ]
+                       ],
+                       'static_currencies' => [
+                               'label_fields' => [
+                                       'cu_name_##', 'cu_name_en',
+                               ],
+                               'isocode_field' => [
+                                       'cu_iso_##',
+                               ]
+                       ]
+               ];
+               if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$extKey]['tables']) && is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$extKey]['tables'])) {
+                       $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$extKey]['tables'] = array_merge($labelTable, $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$extKey]['tables']);
+               } else {
+                       $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$extKey]['tables'] = $labelTable;
+               }
+               // Add data handling hook to manage ISO codes redundancies on records
+               $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'][] = \SJBR\StaticInfoTables\Hook\Core\DataHandling\ProcessDataMap::class;
+               // Register slot for AfterExtensionInstall signal
+               $dispatcher = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\SignalSlot\Dispatcher::class);
+               $dispatcher->connect(\TYPO3\CMS\Extensionmanager\Utility\InstallUtility::class, 'afterExtensionInstall', \SJBR\StaticInfoTables\Slot\Extensionmanager\AfterExtensionInstall::class, 'executeUpdateScript');
+               // Enabling the Static Info Tables Manager module
+               $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$extKey]['enableManager'] = isset($extConf['enableManager']) ? $extConf['enableManager'] : '0';
+               // Make the extension version and constraints available when creating language packs and to other extensions
+               $emConfUtility = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extensionmanager\Utility\EmConfUtility::class);
+               $emConf = $emConfUtility->includeEmConf(['key' => $extKey, 'siteRelPath' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($extKey)]);
+               $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$extKey]['version'] = $emConf[$extKey]['version'];
+               $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$extKey]['constraints'] = $emConf[$extKey]['constraints'];
+               // Configure translation of suggestions labels
+               \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig('<INCLUDE_TYPOSCRIPT: source="FILE:EXT:' . $extKey . '/Configuration/PageTSconfig/Suggest.tsconfig">');
+               $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][\TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList::class]['buildQueryParameters'][] = \SJBR\StaticInfoTables\Hook\Backend\Recordlist\BuildQueryParameters::class;
+       },
+       'static_info_tables'
+);
\ No newline at end of file