forked from georgringer/news
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathext_tables.php
131 lines (115 loc) · 6 KB
/
ext_tables.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<?php
defined('TYPO3_MODE') or die();
$boot = function () {
// CSH - context sensitive help
foreach (['news', 'media', 'file', 'link', 'tag'] as $table) {
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::allowTableOnStandardPages('tx_news_domain_model_' . $table);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr(
'tx_news_domain_model_' . $table, 'EXT:news/Resources/Private/Language/locallang_csh_' . $table . '.xlf');
}
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr(
'tt_content.pi_flexform.news_pi1.list', 'EXT:news/Resources/Private/Language/locallang_csh_flexforms.xlf');
// Extension manager configuration
$configuration = \GeorgRinger\News\Utility\EmConfiguration::getSettings();
if (TYPO3_MODE === 'BE') {
// Override news icon
$GLOBALS['TCA']['pages']['columns']['module']['config']['items'][] = [
0 => 'LLL:EXT:news/Resources/Private/Language/locallang_be.xlf:news-folder',
1 => 'news',
2 => 'apps-pagetree-folder-contains-news'
];
/***************
* Show news table in page module
*/
if ($configuration->getPageModuleFieldsNews()) {
$addTableItems = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(';',
$configuration->getPageModuleFieldsNews(), true);
foreach ($addTableItems as $item) {
$split = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode('=', $item, true);
if (count($split) == 2) {
$fTitle = $split[0];
$fList = $split[1];
} else {
$fTitle = '';
$fList = $split[0];
}
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cms']['db_layout']['addTables']['tx_news_domain_model_news'][] = [
'MENU' => $fTitle,
'fList' => $fList,
'icon' => true,
];
}
}
if ($configuration->getPageModuleFieldsCategory()) {
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cms']['db_layout']['addTables']['sys_category'][0] = [
'fList' => htmlspecialchars($configuration->getPageModuleFieldsCategory()),
'icon' => true
];
}
// Extend user settings
$GLOBALS['TYPO3_USER_SETTINGS']['columns']['newsoverlay'] = [
'label' => 'LLL:EXT:news/Resources/Private/Language/locallang_be.xlf:usersettings.overlay',
'type' => 'select',
'itemsProcFunc' => \GeorgRinger\News\Hooks\ItemsProcFunc::class . '->user_categoryOverlay',
];
$GLOBALS['TYPO3_USER_SETTINGS']['showitem'] .= ',
--div--;LLL:EXT:news/Resources/Private/Language/locallang_be.xlf:pi1_title,newsoverlay';
// Add tables to livesearch (e.g. "#news:fo" or "#newscat:fo")
$GLOBALS['TYPO3_CONF_VARS']['SYS']['livesearch']['news'] = 'tx_news_domain_model_news';
$GLOBALS['TYPO3_CONF_VARS']['SYS']['livesearch']['newstag'] = 'tx_news_domain_model_tag';
/* ===========================================================================
Register BE-Modules
=========================================================================== */
if ($configuration->getShowImporter()) {
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule(
'GeorgRinger.news',
'web',
'tx_news_m1',
'',
['Import' => 'index, runJob, jobInfo'],
[
'access' => 'user,group',
'icon' => 'EXT:news/Resources/Public/Icons/module_import.svg',
'labels' => 'LLL:EXT:news/Resources/Private/Language/locallang_mod.xlf',
]
);
}
/* ===========================================================================
Register BE-Module for Administration
=========================================================================== */
if ($configuration->getShowAdministrationModule()) {
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule(
'GeorgRinger.news',
'web',
'tx_news_m2',
'',
['Administration' => 'index,newNews,newCategory,newTag,newsPidListing'],
[
'access' => 'user,group',
'icon' => 'EXT:news/Resources/Public/Icons/module_administration.svg',
'labels' => 'LLL:EXT:news/Resources/Private/Language/locallang_modadministration.xlf',
]
);
}
/* ===========================================================================
Ajax call to save tags
=========================================================================== */
$GLOBALS['TYPO3_CONF_VARS']['BE']['AJAX']['News::createTag'] = [
'callbackMethod' => \GeorgRinger\News\Hooks\SuggestReceiverCall::class . '->createTag',
'csrfTokenCheck' => false
];
}
/* ===========================================================================
Default configuration
=========================================================================== */
$GLOBALS['TYPO3_CONF_VARS']['EXT']['news']['orderByCategory'] = 'uid,title,tstamp,sorting';
$GLOBALS['TYPO3_CONF_VARS']['EXT']['news']['orderByNews'] = 'tstamp,datetime,crdate,title' . ($configuration->getManualSorting() ? ',sorting' : '');
$GLOBALS['TYPO3_CONF_VARS']['EXT']['news']['orderByTag'] = 'tstamp,crdate,title';
$GLOBALS['TYPO3_CONF_VARS']['EXT']['news']['switchableControllerActions']['list'] = $configuration->getRemoveListActionFromFlexforms();
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::registerPageTSConfigFile(
'news',
'Configuration/TSconfig/Page/news_only.txt',
'EXT:news :: Restrict pages to news records');
};
$boot();
unset($boot);