forked from rupertgermann/tt_news
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ext_localconf.php
76 lines (62 loc) · 3.34 KB
/
ext_localconf.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
<?php
if (!defined("TYPO3_MODE")) {
die ("Access denied.");
}
/**
* Register hooks in TCEmain:
*/
// this hook is used to prevent saving of news or category records which have categories assigned that are not allowed for the current BE user.
// The list of allowed categories can be set with 'tt_news_cat.allowedItems' in user/group TSconfig.
// This check will be disabled until 'options.useListOfAllowedItems' (user/group TSconfig) is set to a value.
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass']['tt_news'] =
\RG\TtNews\Hooks\DataHandlerHook::class;
// this hook is used to prevent saving of a news record that has non-allowed categories assigned when a command is executed (modify,copy,move,delete...).
// it checks if the record has an editlock. If true, nothing will not be saved.
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processCmdmapClass']['tt_news'] =
\RG\TtNews\Hooks\DataHandlerHook::class;
$confArr = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['tt_news']);
TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTypoScriptSetup('
plugin.tt_news = USER
plugin.tt_news {
userFunc = ' . \RG\TtNews\Plugin\TtNews::class . '->main_news
# validate some configuration values and display a message if errors have been found
enableConfigValidation = 1
}
');
// add default rendering for pi_layout plugin
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTypoScript(
'tt_news',
'setup',
'tt_content.list.20.9 =< plugin.tt_news',
'defaultContentRendering'
);
if (TYPO3_MODE === 'BE') {
// Apply PageTSconfig
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig(
'<INCLUDE_TYPOSCRIPT: source="FILE:EXT:tt_news/Configuration/PageTS/PageTs.ts">'
);
// Page module hook
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['list_type_Info']['9']['tt_news'] = \RG\TtNews\Hooks\PageModuleHook::class . '->getExtensionSummary';
}
if (!is_array($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['tt_news_cache'])) {
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['tt_news_cache'] = array(
'backend' => TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::class,
'frontend' => TYPO3\CMS\Core\Cache\Frontend\VariableFrontend::class
);
}
$GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['tt_news_catmenu'] = RG\TtNews\Controller\NewsFrontendAjaxController::class . '::dispatch';
// register news cache table for "clear all caches"
$GLOBALS ['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['clearAllCache_additionalTables']['tt_news_cache'] = 'tt_news_cache';
// in order to make "direct Preview links" for tt_news work again in TYPO3 >= 6, unset pageNotFoundOnCHashError if a BE_USER is logged in
$configuredCookieName = trim($GLOBALS['TYPO3_CONF_VARS']['BE']['cookieName']);
if (empty($configuredCookieName)) {
$configuredCookieName = 'be_typo_user';
}
if ($_COOKIE[$configuredCookieName]) {
$GLOBALS['TYPO3_CONF_VARS']['FE']['pageNotFoundOnCHashError'] = 0;
}
$GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['formDataGroup']['tcaDatabaseRecord'][\RG\TtNews\Form\FormDataProvider::class] = array(
'depends' => array(
\TYPO3\CMS\Backend\Form\FormDataProvider\DatabaseRowInitializeNew::class,
)
);