Resolves #56038: Language Pack Generator crashes in TYPO3 6.0
[TYPO3CMS/Extensions/static_info_tables.git] / ext_localconf.php
1 <?php
2 if (!defined ('TYPO3_MODE')) {
3 die ('Access denied.');
4 }
5
6 if (!defined ('STATIC_INFO_TABLES_EXTkey')) {
7 define('STATIC_INFO_TABLES_EXTkey', $_EXTKEY);
8 }
9
10 if (!defined ('PATH_BE_staticinfotables')) {
11 define('PATH_BE_staticinfotables', \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY));
12 }
13
14 if (!defined ('PATH_BE_staticinfotables_rel')) {
15 define('PATH_BE_staticinfotables_rel', \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath($_EXTKEY));
16 }
17 // Unserializing the configuration so we can use it here
18 $_EXTCONF = unserialize($_EXTCONF);
19
20 // Including Extbase configuration
21 \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTypoScriptSetup('<INCLUDE_TYPOSCRIPT: source="FILE:EXT:' . $_EXTKEY . '/Configuration/TypoScript/Extbase/setup.txt">');
22
23 // Register cache static_info_tables
24 if (!is_array($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'][$_EXTKEY])) {
25 $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'][$_EXTKEY] = array();
26 }
27 if (!isset($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'][$_EXTKEY]['frontend'])) {
28 $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'][$_EXTKEY]['frontend'] = 'TYPO3\\CMS\\Core\\Cache\\Frontend\\PhpFrontend';
29 }
30 if (!isset($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'][$_EXTKEY]['backend'])) {
31 $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'][$_EXTKEY]['backend'] = 'TYPO3\\CMS\\Core\\Cache\\Backend\\FileBackend';
32 }
33
34 // Configure clear cache post processing for extended domain model
35 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['clearCachePostProc'][$_EXTKEY] = 'EXT:' . $_EXTKEY . '/Classes/Cache/ClassCacheManager.php:SJBR\StaticInfoTables\Cache\ClassCacheManager->reBuild';
36
37 // Names of static entities
38 $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$_EXTKEY]['entities'] = array(
39 'Country',
40 'CountryZone',
41 'Currency',
42 'Language',
43 'Territory'
44 );
45
46 // Register cached domain model classes autoloader
47 require_once(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'Classes/Cache/CachedClassLoader.php');
48 \SJBR\StaticInfoTables\Cache\CachedClassLoader::registerAutoloader();
49
50 // Possible label fields for different languages. Default as last.
51 $labelTable = array(
52 'static_territories' => array(
53 'label_fields' => array(
54 'tr_name_##', 'tr_name_en',
55 ),
56 'isocode_field' => array(
57 'tr_iso_##',
58 ),
59 ),
60 'static_countries' => array(
61 'label_fields' => array(
62 'cn_short_##', 'cn_short_en',
63 ),
64 'isocode_field' => array(
65 'cn_iso_##',
66 ),
67 ),
68 'static_country_zones' => array(
69 'label_fields' => array(
70 'zn_name_##', 'zn_name_local',
71 ),
72 'isocode_field' => array(
73 'zn_code', 'zn_country_iso_##',
74 ),
75 ),
76 'static_languages' => array(
77 'label_fields' => array(
78 'lg_name_##', 'lg_name_en',
79 ),
80 'isocode_field' => array(
81 'lg_iso_##', 'lg_country_iso_##',
82 ),
83 ),
84 'static_currencies' => array(
85 'label_fields' => array(
86 'cu_name_##', 'cu_name_en',
87 ),
88 'isocode_field' => array(
89 'cu_iso_##',
90 ),
91 ),
92 );
93
94 if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$_EXTKEY]['tables']) && is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$_EXTKEY]['tables'])) {
95 $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$_EXTKEY]['tables'] = array_merge($labelTable, $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$_EXTKEY]['tables']);
96 } else {
97 $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$_EXTKEY]['tables'] = $labelTable;
98 }
99 unset($labelTable);
100
101 // Registering backend form select field prrenderingfor hook in order to localize selected items
102 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tceforms.php']['getSingleFieldClass'][] = 'SJBR\\StaticInfoTables\\Hook\\Backend\\Form\\ElementRenderingHelper';
103
104 // Add data handling hook to manage ISO codes redundancies on records
105 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'][] = 'SJBR\\StaticInfoTables\\Hook\\Core\\DataHandling\\ProcessDataMap';
106
107 // Enabling the Static Info Tables Manager module
108 $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$_EXTKEY]['enableManager'] = isset($_EXTCONF['enableManager']) ? $_EXTCONF['enableManager'] : '0';
109
110 // Make the extension version and constraints available when creating language packs and to other extensions
111 require_once(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'ext_emconf.php');
112 $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$_EXTKEY]['version'] = $EM_CONF[$_EXTKEY]['version'];
113 $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$_EXTKEY]['constraints'] = $EM_CONF[$_EXTKEY]['constraints'];
114
115 ?>