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!
*/
$localLangDbPath = 'LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:';
$localLangBackendPath = 'LLL:EXT:sg_news/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']['pages']['columns']['doktype']['config']['items'][] = [
$localLangBackendPath . $configuration['locallangIndex'],
$doktype,
$configuration['icon']
];
$GLOBALS['TCA']['pages']['ctrl']['typeicon_classes'][$doktype] = 'tcarecords-pages-' . $doktype;
// add the new doktype to the list of page types
$GLOBALS['PAGES_TYPES'][$doktype] = [
'type' => 'sys',
'icon' => $configuration['icon'],
'allowedTables' => '*',
];
}
$GLOBALS['TCA']['pages']['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:pages.palettes.editorial;editorialWithNewsAuthor,
tx_sgnews_content_from_another_page, tx_sgnews_related_news, tx_sgnews_tags,
--div--;LLL:EXT:seo/Resources/Private/Language/locallang_tca.xlf:pages.tabs.seo,
--palette--;;seo,
' . (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('sg_seo') ? 'tx_sgseo_schemajson,' : '') . '
--palette--;;robots,
--palette--;;canonical,
--palette--;;sitemap,
--div--;LLL:EXT:seo/Resources/Private/Language/locallang_tca.xlf:pages.tabs.socialmedia,
--palette--;;opengraph,
--palette--;;twittercards,
--div--;' . $localLangDbPath . 'pages.tabs.images,
tx_sgnews_teaser2_image, tx_sgnews_teaser1_image,
--palette--;;media,
--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.tabs.metadata,
--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.palettes.abstract;abstract,
--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.tabs.appearance,
--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.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:pages.palettes.visibility;visibility,
--palette--;LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:pages.palettes.access;access,
--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.tabs.behaviour,
--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.palettes.caching;caching,
--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.palettes.miscellaneous;miscellaneous,
--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:language,
--palette--;;language
'
];
$GLOBALS['TCA']['pages']['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--;LLL:EXT:seo/Resources/Private/Language/locallang_tca.xlf:pages.tabs.seo,
--palette--;;seo,
' . (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('sg_seo') ? 'tx_sgseo_schemajson,' : '') . '
--palette--;;robots,
--palette--;;canonical,
--palette--;;sitemap,
--div--;LLL:EXT:seo/Resources/Private/Language/locallang_tca.xlf:pages.tabs.socialmedia,
--palette--;;opengraph,
--palette--;;twittercards,
--div--;' . $localLangDbPath . 'pages.tabs.images,
tx_sgnews_teaser2_image, tx_sgnews_teaser1_image,
--palette--;;media,
--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.tabs.metadata,
--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.palettes.abstract;abstract,
seo_title,canonical_link, ' . (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('yoast_seo') || \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('seo') ? '' : 'description,') . '
--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.tabs.appearance,
--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.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:pages.palettes.visibility;visibility,
--palette--;LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:pages.palettes.access;access,
--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.tabs.behaviour,
--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.palettes.caching;caching,
--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.palettes.miscellaneous;miscellaneous,
--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:language,
--palette--;;language
'
];
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns(
'pages',
[
'tx_sgnews_teaser1_image' => [
'exclude' => TRUE,
'label' => $localLangDbPath . 'pages.tx_sgnews_teaser1_image',
'description' => 'LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:teaser_description',
'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
'tx_sgnews_teaser1_image',
[
'maxitems' => 9999,
'foreign_types' => [
'0' => [
'showitem' => '
--palette--;LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
\TYPO3\CMS\Core\Resource\File::FILETYPE_TEXT => [
'showitem' => '
--palette--;LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
\TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => [
'showitem' => '
--palette--;LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
\TYPO3\CMS\Core\Resource\File::FILETYPE_AUDIO => [
'showitem' => '
--palette--;LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
Fabian Galinski
committed
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_VIDEO => [
'showitem' => '
--palette--;LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_APPLICATION => [
'showitem' => '
--palette--;LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
],
'appearance' => [
'showPossibleLocalizationRecords' => TRUE,
'showSynchronizationLink' => TRUE,
'showAllLocalizationLink' => TRUE,
$GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']
),
],
'tx_sgnews_teaser2_image' => [
'exclude' => TRUE,
'label' => $localLangDbPath . 'pages.tx_sgnews_teaser2_image',
'description' => 'LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:teaser_description',
'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
'tx_sgnews_teaser2_image',
[
'maxitems' => 9999,
'foreign_types' => [
'0' => [
'showitem' => '
--palette--;LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_TEXT => [
'showitem' => '
--palette--;LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => [
'showitem' => '
--palette--;LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_AUDIO => [
'showitem' => '
--palette--;LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_VIDEO => [
'showitem' => '
--palette--;LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_APPLICATION => [
'showitem' => '
--palette--;LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
Stefan Galinski
committed
]
'appearance' => [
'showPossibleLocalizationRecords' => TRUE,
'showSynchronizationLink' => TRUE,
'showAllLocalizationLink' => TRUE,
$GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']
),
],
'tx_sgnews_news_author' => [
'exclude' => TRUE,
'l10n_exclude' => TRUE,
'label' => $localLangDbPath . 'pages.tx_sgnews_news_author',
'config' => [
'type' => 'group',
'internal_type' => 'db',
'allowed' => 'tx_sgnews_domain_model_author',
'minitems' => 0,
'maxitems' => 9,
'items' => [
['', ''],
'behaviour' => [
'allowLanguageSynchronization' => TRUE
],
'fieldWizard' => [
'localizationStateSelector' => TRUE
],
'fieldControl' => [
'addRecord' => [
'disabled' => FALSE,
],
'editPopup' => [
'disabled' => FALSE
]
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
],
],
'tx_sgnews_content_from_another_page' => [
'exclude' => TRUE,
'l10n_exclude' => TRUE,
'label' => $localLangDbPath . 'pages.tx_sgnews_content_from_another_page',
'config' => [
'type' => 'group',
'internal_type' => 'db',
'allowed' => 'pages',
'size' => 1,
'minitems' => 0,
'maxitems' => 1,
'items' => [
['', ''],
]
],
],
'tx_sgnews_related_news' => [
'exclude' => TRUE,
'l10n_exclude' => TRUE,
'label' => $localLangDbPath . 'pages.tx_sgnews_related_news',
'config' => [
'type' => 'group',
'internal_type' => 'db',
'allowed' => 'pages',
'size' => 5,
'minitems' => 0,
'maxitems' => 99
],
],
'tx_sgnews_highlighted' => [
'displayCond' => 'FIELD:tx_sgnews_never_highlighted:=:0',
'onChange' => 'reload',
'exclude' => TRUE,
'l10n_exclude' => TRUE,
'label' => $localLangDbPath . 'pages.tx_sgnews_highlighted',
'config' => [
'type' => 'check',
'behaviour' => [
'allowLanguageSynchronization' => TRUE
]
],
],
'tx_sgnews_never_highlighted' => [
'displayCond' => 'FIELD:tx_sgnews_highlighted:=:0',
'onChange' => 'reload',
'exclude' => TRUE,
'l10n_exclude' => TRUE,
'label' => $localLangDbPath . 'pages.tx_sgnews_never_highlighted',
'config' => [
'type' => 'check',
'behaviour' => [
'allowLanguageSynchronization' => TRUE
]
],
],
'tx_sgnews_tags' => [
'exclude' => TRUE,
'l10n_exclude' => TRUE,
'label' => $localLangDbPath . 'pages.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' => 'pages'
'MM_opposite_field' => 'items',
'renderType' => 'selectTree',
'treeConfig' => [
'parentField' => 'parent',
'appearance' => [
'expandAll' => 1,
'maxLevels' => 99,
'showHeader' => 1
],
'tx_sgnews_likes' => [
'exclude' => TRUE,
'l10n_exclude' => TRUE,
'label' => $localLangDbPath . 'pages.tx_sgnews_likes',
'config' => [
'type' => 'input',
'size' => '20',
'eval' => 'trim',
]
],
'lastUpdated' => [
'exclude' => TRUE,
'l10n_exclude' => TRUE,
'label' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.lastUpdated',
'config' => [
'type' => 'input',
'renderType' => 'inputDateTime',
'size' => '13',
'eval' => 'datetime',
'default' => $GLOBALS['EXEC_TIME'],
'behaviour' => [
'allowLanguageSynchronization' => TRUE,
]
]
],
'tx_sgnews_date_end' => [
'exclude' => TRUE,
'l10n_exclude' => TRUE,
'label' => 'LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:pages.tx_sgnews_date_end',
'config' => [
'type' => 'input',
'renderType' => 'inputDateTime',
'size' => '13',
'eval' => 'datetime',
'default' => $GLOBALS['EXEC_TIME'],
'behaviour' => [
'allowLanguageSynchronization' => TRUE,
]
]
],
'tx_sgnews_location' => [
'exclude' => TRUE,
'label' => $localLangDbPath . 'pages.tx_sgnews_location',
'config' => [
'type' => 'input',
'size' => 20,
'eval' => 'trim',
'behaviour' => [
'allowLanguageSynchronization' => TRUE
]
]
],
'tx_sgnews_comments_enable' => [
'exclude' => TRUE,
'label' => $localLangDbPath . 'pages.tx_sgnews_comments_enable',
'config' => [
'type' => 'check',
'default' => 1
]
]
]
);
$GLOBALS['TCA']['pages']['palettes']['titleDescriptionAndHighlightFlag'] = [
'showitem' => 'subtitle;' . $localLangDbPath . 'pages.subtitle.inPalette,
--linebreak--, title,
' . (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('yoast_seo') || \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('seo') ? '' : '--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,
--linebreak--, tx_sgnews_comments_enable',
'canNotCollapse' => 1,
];
$GLOBALS['TCA']['pages']['palettes']['editorialWithNewsAuthor'] = [
'showitem' => 'tx_sgnews_news_author,
--linebreak--, lastUpdated;LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.lastUpdated_formlabel,
tx_sgnews_date_end,
--linebreak--,tx_sgnews_likes,--linebreak--,tx_sgnews_location',
'canNotCollapse' => 1,
];
foreach ($GLOBALS['TCA']['pages']['columns'] as $languageExcludeField => $_) {
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
$fieldNames = [
'doktype',
'title',
'subtitle',
'description',
'slug',
'tx_projectbase_path_segment',
'tx_projectbase_excludefromsluggeneration',
'tx_sgnews_location',
'tx_sgnews_teaser1_image',
'tx_sgnews_teaser2_image',
'tx_sgnews_tags',
'abstract',
'seo_title',
'canonical_link',
'hidden',
'sys_language_uid',
'tx_languagevisibility_visibility',
'lastUpdated',
'tx_sgnews_date_end',
'tx_sgnews_highlighted',
'tx_sgnews_never_highlighted',
'tx_sgnews_comments_enable',
'og_title',
'og_description',
'og_image',
'twitter_title',
'twitter_description',
'twitter_image',
'twitter_card'
];
Georgi Mateev
committed
if (!in_array($languageExcludeField, $fieldNames)) {
$GLOBALS['TCA']['pages']['types'][\SGalinski\SgNews\Utility\BackendNewsUtility::NEWS_DOKTYPE]['columnsOverrides'][$languageExcludeField]['l10n_mode'] = 'exclude';
}
}
$GLOBALS['TCA']['pages']['types'][\SGalinski\SgNews\Utility\BackendNewsUtility::NEWS_DOKTYPE]['columnsOverrides']['title']['label'] =
'LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:pages.title';
$GLOBALS['TCA']['pages']['types'][\SGalinski\SgNews\Utility\BackendNewsUtility::NEWS_DOKTYPE]['columnsOverrides']['subtitle']['label'] =
'LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:pages.subtitle';
$GLOBALS['TCA']['pages']['types'][\SGalinski\SgNews\Utility\BackendNewsUtility::NEWS_DOKTYPE]['columnsOverrides']['slug']['label'] =
'LLL:EXT:sg_news/Resources/Private/Language/locallang_db.xlf:pages.slug';