Newer
Older
/**
*
* Copyright notice
*
* (c) sgalinski Internet Services (https://www.sgalinski.de)
*
* 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 3 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!
*/
call_user_func(
function ($extKey, $table) {
$localLangDbPath = 'LLL:EXT:' . $extKey . '/Resources/Private/Language/locallang_db.xlf:';
$localLangBackendPath = 'LLL:EXT:' . $extKey . '/Resources/Private/Language/locallang_backend.xlf:';
foreach (
\SGalinski\SgNews\Utility\BackendNewsUtility::CATEGORY_DOKTYPE => [
'icon' => 'EXT:sg_news/Resources/Public/Images/Category.png',
'locallangIndex' => 'pageType.category'
\SGalinski\SgNews\Utility\BackendNewsUtility::NEWS_DOKTYPE => [
'icon' => 'EXT:sg_news/Resources/Public/Images/News.png',
'locallangIndex' => 'pageType.news'
]
] as $doktype => $configuration) {
// add the new doktype to the page type selector
$GLOBALS['TCA'][$table]['columns']['doktype']['config']['items'][] = [
$localLangBackendPath . $configuration['locallangIndex'],
$doktype,
$configuration['icon']
];
// also add the new doktype to the page language overlays type selector (so that translations can inherit the same type)
$GLOBALS['TCA']['' . $table . '_language_overlay']['columns']['doktype']['config']['items'][] = [
$localLangBackendPath . $configuration['locallangIndex'],
$doktype,
$configuration['icon']
];
$GLOBALS['TCA'][$table]['ctrl']['typeicon_classes'][$doktype] = 'tcarecords-' . $table . '-' . $doktype;
// add the new doktype to the list of page types
$GLOBALS['PAGES_TYPES'][$doktype] = [
'type' => 'sys',
'icon' => $configuration['icon'],
'allowedTables' => '*',
];
}
$GLOBALS['TCA'][$table]['types'][\SGalinski\SgNews\Utility\BackendNewsUtility::NEWS_DOKTYPE] = [
'showitem' => '--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general,
--palette--;;standard,
--palette--;;titleDescriptionAndHighlightFlag,
--palette--;LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:' . $table . '.palettes.editorial;editorialWithNewsAuthor,
tx_sgnews_content_from_another_page, tx_sgnews_related_news, tx_sgnews_tags,
--div--;' . $localLangDbPath . $table . '.tabs.images,
tx_sgnews_teaser2_image, tx_sgnews_teaser1_image,
--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:' . $table . '.tabs.metadata,
tx_projectbase_devnullrobots_flags,
--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:' . $table . '.palettes.abstract;abstract,
tx_projectbase_seo_titletag,tx_projectbase_seo_canonicaltag,
--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:' . $table . '.tabs.appearance,
--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:' . $table . '.palettes.layout;layout,
--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:access,
--palette--;LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:' . $table . '.palettes.visibility;visibility,
--palette--;LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:' . $table . '.palettes.access;access,
--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:' . $table . '.tabs.behaviour,
--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:' . $table . '.palettes.caching;caching,
--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:' . $table . '.palettes.miscellaneous;miscellaneous,
--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:language,
--palette--;;language
'
];
$GLOBALS['TCA'][$table]['types'][\SGalinski\SgNews\Utility\BackendNewsUtility::CATEGORY_DOKTYPE] = [
'showitem' => '--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general,
--palette--;;standard,
title, slug, tx_projectbase_path_segment, tx_projectbase_excludefromsluggeneration, tx_realurl_pathsegment, tx_realurl_exclude,
--div--;' . $localLangDbPath . $table . '.tabs.images,
tx_sgnews_teaser2_image, tx_sgnews_teaser1_image,
--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:' . $table . '.tabs.metadata,
tx_projectbase_devnullrobots_flags,
--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:' . $table . '.palettes.abstract;abstract,
tx_projectbase_seo_titletag,tx_projectbase_seo_canonicaltag, description,
--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:' . $table . '.tabs.appearance,
--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:' . $table . '.palettes.layout;layout,
--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:access,
--palette--;LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:' . $table . '.palettes.visibility;visibility,
--palette--;LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:' . $table . '.palettes.access;access,
--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:' . $table . '.tabs.behaviour,
--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:' . $table . '.palettes.caching;caching,
--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:' . $table . '.palettes.miscellaneous;miscellaneous,
--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:language,
--palette--;;language
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
'
];
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns(
$table, [
'tx_sgnews_teaser1_image' => [
'exclude' => TRUE,
'label' => $localLangDbPath . $table . '.tx_sgnews_teaser1_image',
'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
'tx_sgnews_teaser1_image',
[
'maxitems' => 9999,
'foreign_types' => [
'0' => [
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_TEXT => [
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => [
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_AUDIO => [
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_VIDEO => [
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_APPLICATION => [
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
]
],
'appearance' => [
'showPossibleLocalizationRecords' => TRUE,
'showRemovedLocalizationRecords' => TRUE,
'showSynchronizationLink' => TRUE,
'showAllLocalizationLink' => TRUE,
],
],
$GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']
),
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
'tx_sgnews_teaser2_image' => [
'exclude' => TRUE,
'label' => $localLangDbPath . $table . '.tx_sgnews_teaser2_image',
'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
'tx_sgnews_teaser2_image',
[
'maxitems' => 9999,
'foreign_types' => [
'0' => [
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_TEXT => [
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => [
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_AUDIO => [
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_VIDEO => [
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_APPLICATION => [
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
]
],
'appearance' => [
'showPossibleLocalizationRecords' => TRUE,
'showRemovedLocalizationRecords' => TRUE,
'showSynchronizationLink' => TRUE,
'showAllLocalizationLink' => TRUE,
],
],
$GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']
),
Fabian Galinski
committed
'tx_sgnews_news_author' => [
'exclude' => TRUE,
'l10n_exclude' => TRUE,
Fabian Galinski
committed
'label' => $localLangDbPath . $table . '.tx_sgnews_news_author',
'config' => [
'type' => 'group',
'internal_type' => 'db',
Fabian Galinski
committed
'allowed' => 'tx_sgnews_domain_model_author',
'minitems' => 0,
'maxitems' => 9,
'items' => [
['', ''],
],
'wizards' => [
'suggest' => [
'type' => 'suggest',
],
],
Fabian Galinski
committed
'fieldControl' => [
'addRecord' => [
'disabled' => FALSE,
],
],
'tx_sgnews_content_from_another_page' => [
'exclude' => TRUE,
'l10n_exclude' => TRUE,
'label' => $localLangDbPath . $table . '.tx_sgnews_content_from_another_page',
'config' => [
'type' => 'group',
'internal_type' => 'db',
'allowed' => 'pages',
'size' => 1,
'minitems' => 0,
'maxitems' => 1,
'items' => [
['', ''],
],
'wizards' => [
'suggest' => [
'type' => 'suggest',
],
],
],
],
'tx_sgnews_related_news' => [
'exclude' => TRUE,
'l10n_exclude' => TRUE,
'label' => $localLangDbPath . $table . '.tx_sgnews_related_news',
'config' => [
'type' => 'group',
'internal_type' => 'db',
'allowed' => $table,
'size' => 5,
'minitems' => 0,
'maxitems' => 99,
'wizards' => [
'suggest' => [
'type' => 'suggest',
],
],
],
'tx_sgnews_highlighted' => [
'displayCond' => 'FIELD:tx_sgnews_never_highlighted:=:0',
'onChange' => 'reload',
'exclude' => TRUE,
'l10n_exclude' => TRUE,
'label' => $localLangDbPath . $table . '.tx_sgnews_highlighted',
'config' => [
'type' => 'check',
'tx_sgnews_never_highlighted' => [
'displayCond' => 'FIELD:tx_sgnews_highlighted:=:0',
'onChange' => 'reload',
'exclude' => TRUE,
'l10n_exclude' => TRUE,
'label' => $localLangDbPath . $table . '.tx_sgnews_never_highlighted',
'config' => [
'type' => 'check',
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
'tx_sgnews_tags' => [
'exclude' => 1,
'label' => $localLangDbPath . $table . '.tx_sgnews_tags',
'config' => [
'type' => 'select',
'maxitems' => 9999,
'size' => 10,
'foreign_table' => 'sys_category',
'foreign_table_where' => 'AND (IF (###PAGE_TSCONFIG_ID### = 0, 1, sys_category.pid = ###PAGE_TSCONFIG_ID###)) AND sys_category.sys_language_uid IN (-1, 0) ORDER BY sys_category.sorting ASC',
'MM' => 'sys_category_record_mm',
'MM_match_fields' => [
'fieldname' => 'tx_sgnews_tags',
'tablenames' => $table
],
'MM_opposite_field' => 'items',
'renderType' => 'selectTree',
'treeConfig' => [
'parentField' => 'parent',
'appearance' => [
'expandAll' => 1,
'maxLevels' => 99,
'showHeader' => 1
]
]
]
],
'tx_sgnews_likes' => [
'label' => $localLangDbPath . $table . '.tx_sgnews_likes',
'config' => [
'type' => 'input',
'size' => '20',
'eval' => 'trim',
]
],
'lastUpdated' => [
'exclude' => TRUE,
'label' => 'LLL:EXT:cms/locallang_tca.xlf:' . $table . '.lastUpdated',
'config' => [
'type' => 'input',
'size' => '13',
'max' => '20',
'eval' => 'datetime',
'default' => $GLOBALS['EXEC_TIME'],
'behaviour' => [
'allowLanguageSynchronization' => TRUE,
]
'tx_sgnews_date_end' => [
'exclude' => TRUE,
'label' => 'LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:pages.tx_sgnews_date_end',
'config' => [
'type' => 'input',
'size' => '13',
'max' => '20',
'eval' => 'datetime',
'default' => $GLOBALS['EXEC_TIME'],
'behaviour' => [
'allowLanguageSynchronization' => TRUE,
]
'tx_sgnews_location' => [
'exclude' => TRUE,
'label' => $localLangDbPath . $table . '.tx_sgnews_location',
'config' => [
'type' => 'input',
'size' => 20,
'eval' => 'trim',
'behaviour' => [
'allowLanguageSynchronization' => TRUE
]
$GLOBALS['TCA'][$table]['palettes']['titleDescriptionAndHighlightFlag'] = [
'showitem' => 'subtitle;' . $localLangDbPath . $table . '.subtitle.inPalette,
--linebreak--, description,
--linebreak--, slug,
--linebreak--, tx_projectbase_path_segment, tx_projectbase_excludefromsluggeneration,
--linebreak--, tx_realurl_pathsegment, tx_realurl_exclude,
--linebreak--, tx_sgnews_highlighted, tx_sgnews_never_highlighted',
'canNotCollapse' => 1,
];
$GLOBALS['TCA'][$table]['palettes']['editorialWithNewsAuthor'] = [
Fabian Galinski
committed
'showitem' => 'tx_sgnews_news_author,
--linebreak--, lastUpdated;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:' . $table . '.lastUpdated_formlabel,
tx_sgnews_date_end,
--linebreak--,tx_sgnews_likes,--linebreak--,tx_sgnews_location',
'canNotCollapse' => 1,
];
// Removal of the realurl fields, if the extension isn't installed.
if (!\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('realurl')) {
$GLOBALS['TCA'][$table]['palettes']['titleDescriptionAndHighlightFlag'] = str_replace(
'--linebreak--, tx_realurl_pathsegment, tx_realurl_exclude,', '',
$GLOBALS['TCA'][$table]['palettes']['titleDescriptionAndHighlightFlag']
);
$GLOBALS['TCA'][$table]['types'][117] = str_replace(
'tx_realurl_pathsegment, tx_realurl_exclude,', '',
$GLOBALS['TCA'][$table]['types'][117]
);
}
if (\version_compare(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getCurrentTypo3Version(), '9.0.0', '>')) {
// if TYPO3 9.5, exclude a lot of fields from the news doktype in localizations
foreach (
$GLOBALS['TCA'][$table]['columns'] as $languageExcludeField => $_
) {
if (
!\in_array($languageExcludeField, [
'doktype',
'subtitle',
'description',
'slug',
'tx_projectbase_path_segment',
'tx_projectbase_excludefromsluggeneration',
'tx_sgnews_location',
'tx_sgnews_teaser1_image',
'tx_sgnews_teaser2_image',
'abstract',
'tx_projectbase_seo_titletag',
'tx_projectbase_seo_canonicaltag',
'hidden',
'sys_language_uid',
'tx_languagevisibility_visibility',
'lastUpdated',
'tx_sgnews_date_end',
])
) {
$GLOBALS['TCA'][$table]['types'][\SGalinski\SgNews\Utility\BackendNewsUtility::NEWS_DOKTYPE]['columnsOverrides'][$languageExcludeField]['l10n_mode'] = 'exclude';
}
}
$GLOBALS['TCA'][$table]['types'][\SGalinski\SgNews\Utility\BackendNewsUtility::NEWS_DOKTYPE]['columnsOverrides']['title']['label'] =
'LLL:EXT:' . $extKey . '/Resources/Private/Language/locallang_db.xlf:' . $table . '.title';
$GLOBALS['TCA'][$table]['types'][\SGalinski\SgNews\Utility\BackendNewsUtility::NEWS_DOKTYPE]['columnsOverrides']['subtitle']['label'] =
'LLL:EXT:' . $extKey . '/Resources/Private/Language/locallang_db.xlf:' . $table . '.subtitle';
$GLOBALS['TCA'][$table]['types'][\SGalinski\SgNews\Utility\BackendNewsUtility::NEWS_DOKTYPE]['columnsOverrides']['slug']['label'] =
'LLL:EXT:' . $extKey . '/Resources/Private/Language/locallang_db.xlf:' . $table . '.slug';
}, 'sg_news', 'pages'
);