Resolves #45901: Add extbase persistence configuration and field mapping
[TYPO3CMS/Extensions/static_info_tables.git] / ext_tables.php
1 <?php
2 if (!defined ('TYPO3_MODE')) {
3 die ('Access denied.');
4 }
5
6 // Configure extension static template
7 \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile('static_info_tables', 'Configuration/TypoScript/Static', 'Static Info Tables');
8
9 $extensionResourcesLanguagePath = 'LLL:EXT:static_info_tables/Resources/Private/Language/locallang_db.xlf:';
10 $extensionConfigurationTcaPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('static_info_tables') . 'Configuration/Tca/';
11 $extensionResourcesIconsPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('static_info_tables') . 'Resources/Public/Images/Icons/';
12
13 // Country reference data from ISO 3166-1
14 $GLOBALS['TCA']['static_countries'] = array(
15 'ctrl' => array(
16 'label' => 'cn_short_en',
17 'label_alt' => 'cn_iso_2',
18 'label_alt_force' => 1,
19 'label_userFunc' => 'SJBR\StaticInfoTables\Hook\Backend\Form\ElementRenderingHelper->addIsoCodeToLabel',
20 'adminOnly' => 1,
21 'rootLevel' => 1,
22 'is_static' => 1,
23 'default_sortby' => 'ORDER BY cn_short_en',
24 'delete' => 'deleted',
25 'title' => $extensionResourcesLanguagePath . 'static_countries.title',
26 'dynamicConfigFile' => $extensionConfigurationTcaPath . 'Country.php',
27 'iconfile' => $extensionResourcesIconsPath . 'icon_static_countries.gif',
28 ),
29 'interface' => array(
30 'showRecordFieldList' => 'cn_iso_2,cn_iso_3,cn_iso_nr,cn_official_name_local,cn_official_name_en,cn_capital,cn_tldomain,cn_currency_iso_3,cn_currency_iso_nr,cn_phone,cn_uno_member,cn_eu_member,cn_address_format,cn_short_en'
31 )
32 );
33
34 // Country subdivision reference data from ISO 3166-2
35 $GLOBALS['TCA']['static_country_zones'] = array(
36 'ctrl' => array(
37 'label' => 'zn_name_local',
38 'label_alt' => 'zn_name_local,zn_code',
39 'adminOnly' => 1,
40 'rootLevel' => 1,
41 'is_static' => 1,
42 'default_sortby' => 'ORDER BY zn_name_local',
43 'delete' => 'deleted',
44 'title' => $extensionResourcesLanguagePath . 'static_country_zones.title',
45 'dynamicConfigFile' => $extensionConfigurationTcaPath . 'CountryZone.php',
46 'iconfile' => $extensionResourcesIconsPath . 'icon_static_countries.gif',
47 ),
48 'interface' => array(
49 'showRecordFieldList' => 'zn_country_iso_nr,zn_country_iso_3,zn_code,zn_name_local,zn_name_en'
50 )
51 );
52
53 // Currency reference data from ISO 4217
54 $GLOBALS['TCA']['static_currencies'] = array(
55 'ctrl' => array(
56 'label' => 'cu_name_en',
57 'label_alt' => 'cu_iso_3',
58 'label_alt_force' => 1,
59 'label_userFunc' => 'SJBR\StaticInfoTables\Hook\Backend\Form\ElementRenderingHelper->addIsoCodeToLabel',
60 'adminOnly' => 1,
61 'rootLevel' => 1,
62 'is_static' => 1,
63 'default_sortby' => 'ORDER BY cu_name_en',
64 'delete' => 'deleted',
65 'title' => $extensionResourcesLanguagePath . 'static_currencies.title',
66 'dynamicConfigFile' => $extensionConfigurationTcaPath . 'Currency.php',
67 'iconfile' => $extensionResourcesIconsPath . 'icon_static_currencies.gif',
68 ),
69 'interface' => array(
70 'showRecordFieldList' => 'cu_iso_3,cu_iso_nr,cu_name_en,cu_symbol_left,cu_symbol_right,cu_thousands_point,cu_decimal_point,cu_decimal_digits,cu_sub_name_en,cu_sub_divisor,cu_sub_symbol_left,cu_sub_symbol_right'
71 )
72 );
73
74 // Language reference data from ISO 639-1
75 $GLOBALS['TCA']['static_languages'] = array(
76 'ctrl' => array(
77 'label' => 'lg_name_en',
78 'label_alt' => 'lg_iso_2',
79 'label_alt_force' => 1,
80 'label_userFunc' => 'SJBR\StaticInfoTables\Hook\Backend\Form\ElementRenderingHelper->addIsoCodeToLabel',
81 'adminOnly' => 1,
82 'rootLevel' => 1,
83 'is_static' => 1,
84 'default_sortby' => 'ORDER BY lg_name_en',
85 'delete' => 'deleted',
86 'title' => $extensionResourcesLanguagePath . 'static_languages.title',
87 'dynamicConfigFile' => $extensionConfigurationTcaPath . 'Language.php',
88 'iconfile' => $extensionResourcesIconsPath . 'icon_static_languages.gif',
89 ),
90 'interface' => array(
91 'showRecordFieldList' => 'lg_name_local,lg_name_en,lg_iso_2,lg_typo3,lg_country_iso_2,lg_collate_locale,lg_sacred,lg_constructed'
92 )
93 );
94
95 // UN Territory reference data
96 $GLOBALS['TCA']['static_territories'] = array(
97 'ctrl' => array(
98 'label' => 'tr_name_en',
99 'label_alt' => 'tr_iso_nr',
100 'label_alt_force' => 1,
101 'label_userFunc' => 'SJBR\StaticInfoTables\Hook\Backend\Form\ElementRenderingHelper->addIsoCodeToLabel',
102 'adminOnly' => 1,
103 'rootLevel' => 1,
104 'is_static' => 1,
105 'default_sortby' => 'ORDER BY tr_name_en',
106 'delete' => 'deleted',
107 'title' => $extensionResourcesLanguagePath . 'static_territories.title',
108 'dynamicConfigFile' => $extensionConfigurationTcaPath . 'Territory.php',
109 'iconfile' => $extensionResourcesIconsPath . 'icon_static_territories.gif',
110 ),
111 'interface' => array(
112 'showRecordFieldList' => 'tr_name_en,tr_iso_nr'
113 )
114 );
115
116 unset($extensionResourcesLanguagePath);
117 unset($extensionConfigurationTcaPath);
118 unset($extensionResourcesIconsPath);
119
120 // Configure static language field of sys_language table
121 \TYPO3\CMS\Core\Utility\GeneralUtility::loadTCA('sys_language');
122 $GLOBALS['TCA']['sys_language']['columns']['static_lang_isocode']['config'] = array(
123 'type' => 'select',
124 'items' => array(
125 array('',0),
126 ),
127 'foreign_table' => 'static_languages',
128 'foreign_table_where' => 'AND static_languages.pid=0 ORDER BY static_languages.lg_name_en',
129 'itemsProcFunc' => 'SJBR\StaticInfoTables\Hook\Backend\Form\ElementRenderingHelper->translateLanguagesSelector',
130 'size' => 1,
131 'minitems' => '0',
132 'maxitems' => 1,
133 'wizards' => array(
134 'suggest' => array(
135 'type' => 'suggest',
136 'default' => array(
137 'receiverClass' => 'SJBR\StaticInfoTables\Hook\Backend\Form\SuggestReceiver'
138 )
139 )
140 )
141 );
142
143 // Add data handling hook to manage ISO codes redundancies on records
144 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'][] = 'SJBR\StaticInfoTables\Hook\Core\DataHandling\ProcessDataMap';
145
146 ?>