-
Notifications
You must be signed in to change notification settings - Fork 1
/
ext_localconf.php
161 lines (143 loc) · 7.23 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
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
<?php
declare(strict_types=1);
use Porthd\Timer\Constants\TimerConst;
use Porthd\Timer\CustomTimer\HolidayTimer;
use Porthd\Timer\CustomTimer\DailyTimer;
use Porthd\Timer\CustomTimer\DatePeriodTimer;
use Porthd\Timer\CustomTimer\DefaultTimer;
use Porthd\Timer\CustomTimer\EasterRelTimer;
use Porthd\Timer\CustomTimer\MoonphaseRelTimer;
use Porthd\Timer\CustomTimer\MoonriseRelTimer;
use Porthd\Timer\CustomTimer\PeriodListTimer;
use Porthd\Timer\CustomTimer\RangeListTimer;
use Porthd\Timer\CustomTimer\SunriseRelTimer;
use Porthd\Timer\CustomTimer\WeekdayInMonthTimer;
use Porthd\Timer\CustomTimer\WeekdaylyTimer;
use Porthd\Timer\CustomTimer\JewishHolidayTimer;
use Porthd\Timer\CustomTimer\CalendarDateRelTimer;
use Porthd\Timer\Hooks\Backend\FlexformManipulationHook;
use Porthd\Timer\Hooks\Backend\StartEndTimerManipulationHook;
use TYPO3\CMS\Core\Cache\Frontend\VariableFrontend;
use Porthd\Timer\Hooks\FlexFormParsingHook;
use Porthd\Timer\Utilities\ConfigurationUtility;
use TYPO3\CMS\Core\Configuration\ExtensionConfiguration;
use TYPO3\CMS\Core\Configuration\FlexForm\FlexFormTools;
use TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider;
use TYPO3\CMS\Core\Imaging\IconRegistry;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
defined('TYPO3') || die('Access denied in ' . __FILE__ . '.');
/***************************************************************
*
* Copyright notice
*
* (c) 2020 Dr. Dieter Porth <info@mobger.de>
*
* All rights reserved
*
* This script 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 copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
call_user_func(
static function () {
// Hook for dynamically generated flexformsfiles
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][FlexFormTools::class]['flexParsing'][] =
FlexFormParsingHook::class;
// declare namespace in fluid-taemplates
$GLOBALS['TYPO3_CONF_VARS']['SYS']['fluid']['namespaces']['timer'] = ['Porthd\\Timer\\ViewHelpers'];
// the icons for the content-element and for the extension of the extension icon
$iconRegistry = GeneralUtility::makeInstance(
IconRegistry::class
);
foreach ([
'tx_timer-timer' => 'EXT:timer/Resources/Public/Icons/icon_timer.svg',
'tx_timer_timersimul' => 'EXT:timer/Resources/Public/Icons/Content/timersimul.svg',
'tx_timer_periodlist' => 'EXT:timer/Resources/Public/Icons/Content/periodlist.svg',
'tx_timer_holidaycalendar' => 'EXT:timer/Resources/Public/Icons/Content/holidaycalendar.svg',
] as $name => $path
) {
$iconRegistry->registerIcon(
$name, // Icon-Identifier, e.g. tx-myext-action-preview
SvgIconProvider::class,
['source' => $path]
);
}
// allow default-values like `now` `+1 day` or similiar as default-Value in Flexforms
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][FlexFormTools::class]['flexParsing'][] =
FlexformManipulationHook::class;
// reset starttime and endtime after changes in tx_timer_select and tx_timer_timer
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'][] =
StartEndTimerManipulationHook::class;
// Parts of code, which can by the extension-constants be controlled
$timerConfig = GeneralUtility::makeInstance(ExtensionConfiguration::class)
->get(TimerConst::EXTENSION_NAME);
// disallow usage of timer from the extension via the configuration
$addTimerFlags = (int)((empty($timerConfig['useInternalTimer'])) ? 8191 : $timerConfig['useInternalTimer']);
if ($addTimerFlags >= 1) {
// Sum as Defaultvalue => 8191 = 1+ 2 + 4+ 8+ ... +4096;
$listOfTimerClasses = [
DailyTimer::class, // => 1
DatePeriodTimer::class, // => 2
DefaultTimer::class, // => 4
EasterRelTimer::class, // => 8
MoonphaseRelTimer::class, // => 16
MoonriseRelTimer::class, // => 32
PeriodListTimer::class, // => 64
RangeListTimer::class, // => 128
SunriseRelTimer::class, // => 256
WeekdayInMonthTimer::class, // => 512
WeekdaylyTimer::class, // => 1024
JewishHolidayTimer::class, // => 2048
HolidayTimer::class, // => 4096
];
ConfigurationUtility::addExtLocalconfTimerAdding($addTimerFlags, $listOfTimerClasses);
$tsConfig =
"@import 'EXT:timer/Configuration/TsConfig/Page/BackendPreview.tsconfig'" .
"\n" .
"@import 'EXT:timer/Configuration/TsConfig/Page/RteTimerSimul.tsconfig'";
ExtensionManagementUtility::addPageTSConfig($tsConfig);
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'][TimerConst::CACHE_IDENT_TIMER_YAMLLIST] ??= [];
if (!array_key_exists('frontend', $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'][TimerConst::CACHE_IDENT_TIMER_YAMLLIST])) {
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'][TimerConst::CACHE_IDENT_TIMER_YAMLLIST]['frontend'] = VariableFrontend::class;
}
}
// definen special field for timegaps in field `durationMinutes` et al.`
$GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeRegistry'][1694842416] = [
'nodeName' => 'durationMinutesField',
'priority' => 1,
'class' => \Porthd\Timer\Form\Element\DurationMinutesFieldElement::class,
];
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTypoScript(
'timer',
'setup',
"@import 'EXT:timer/Configuration/TypoScript/setup.typoscript'"
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTypoScript(
'timer',
'constants',
"@import 'EXT:timer/Configuration/TypoScript/constants.typoscript'"
);
// define the caching for timer
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['timer_dataprocessor']
??= [];
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['timer_dataprocessor'] = array_merge(
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['timer_dataprocessor'],
[
'frontend' => \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend::class,
'backend' => \TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend::class,
'options' => [
'defaultLifetime' => 864000, // 10 days
// 'compression' => true,
],
'groups' => ['pages'],
],
);
}
);