-
Notifications
You must be signed in to change notification settings - Fork 34
/
ext_localconf.php
117 lines (102 loc) · 4.62 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
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
<?php
use Tpwd\KeSearch\UserFunction\CustomFieldValidation\FilterOptionTagValidator;
defined('TYPO3') or die();
(function () {
// Add Searchbox Plugin
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTypoScript(
'tx_kesearch',
'setup',
'
plugin.tx_kesearch_pi1 = USER_INT
plugin.tx_kesearch_pi1.userFunc = Tpwd\KeSearch\Plugins\SearchboxPlugin->main
tt_content.ke_search_pi1 =< lib.contentElement
tt_content.ke_search_pi1 {
templateName = Generic
20 =< plugin.tx_kesearch_pi1
}
',
'defaultContentRendering'
);
// add Resultlist Plugin
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTypoScript(
'tx_kesearch',
'setup',
'
plugin.tx_kesearch_pi2 = USER_INT
plugin.tx_kesearch_pi2.userFunc = Tpwd\KeSearch\Plugins\ResultlistPlugin->main
tt_content.ke_search_pi2 =< lib.contentElement
tt_content.ke_search_pi2 {
templateName = Generic
20 =< plugin.tx_kesearch_pi2
}
',
'defaultContentRendering'
);
// Add cachable Searchbox Plugin (USER instead of USER_INT)
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTypoScript(
'tx_kesearch',
'setup',
'
plugin.tx_kesearch_pi3 = USER
plugin.tx_kesearch_pi3.userFunc = Tpwd\KeSearch\Plugins\SearchboxPlugin->main
tt_content.ke_search_pi3 =< lib.contentElement
tt_content.ke_search_pi3 {
templateName = Generic
20 =< plugin.tx_kesearch_pi3
}
',
'defaultContentRendering'
);
// add page TSconfig (Content element wizard icons, hide index table)
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig(
'<INCLUDE_TYPOSCRIPT: source="FILE:EXT:ke_search/Configuration/TSconfig/Page/pageTSconfig.tsconfig">'
);
// use hooks for generation of sortdate values
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['registerAdditionalFields'][] =
\Tpwd\KeSearch\Hooks\AdditionalFields::class;
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyPagesIndexEntry'][] =
\Tpwd\KeSearch\Hooks\AdditionalFields::class;
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyContentIndexEntry'][] =
\Tpwd\KeSearch\Hooks\AdditionalFields::class;
// Custom validators for TCA (eval)
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tce']['formevals'][FilterOptionTagValidator::class] = '';
// logging
$extConf = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
\TYPO3\CMS\Core\Configuration\ExtensionConfiguration::class
)->get('ke_search');
$loglevel = strtolower($extConf['loglevel'] ?? 'ERROR');
$GLOBALS['TYPO3_CONF_VARS']['LOG']['Tpwd']['KeSearch']['writerConfiguration'] = [
$loglevel => [
\TYPO3\CMS\Core\Log\Writer\FileWriter::class => [
'logFileInfix' => 'kesearch',
],
],
];
// register "after save" hook
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass']
['ke_search-filter-option'] = \Tpwd\KeSearch\Hooks\FilterOptionHook::class;
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processCmdmapClass']
['ke_search-filter-option'] = \Tpwd\KeSearch\Hooks\FilterOptionHook::class;
// Custom aspects for routing
$GLOBALS['TYPO3_CONF_VARS']['SYS']['routing']['aspects']['KeSearchUrlEncodeMapper'] =
\Tpwd\KeSearch\Routing\Aspect\KeSearchUrlEncodeMapper::class;
$GLOBALS['TYPO3_CONF_VARS']['SYS']['routing']['aspects']['KeSearchTagToSlugMapper'] =
\Tpwd\KeSearch\Routing\Aspect\KeSearchTagToSlugMapper::class;
// Exclude ke_search parameters from cacheHash calculation
$GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludedParameters'] = array_merge(
$GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludedParameters'],
['^tx_kesearch_pi1']
);
// register statistics tables for garbage collection
// see https://docs.typo3.org/c/typo3/cms-scheduler/main/en-us/Installation/BaseTasks/Index.html#table-garbage-collection-task-example
if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('scheduler')) {
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][\TYPO3\CMS\Scheduler\Task\TableGarbageCollectionTask::class]['options']['tables']['tx_kesearch_stat_search'] = [
'dateField' => 'tstamp',
'expirePeriod' => '180', // days
];
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][\TYPO3\CMS\Scheduler\Task\TableGarbageCollectionTask::class]['options']['tables']['tx_kesearch_stat_word'] = [
'dateField' => 'tstamp',
'expirePeriod' => '180', // days
];
}
})();