Skip to content

Commit a730f9f

Browse files
committed
[TASK] Finalize list_type => CType migration
For TYPO3 v14, references to list_type should be removed entirely. For TYPO3 v13, PluginUpdater could still work, but should be executed before PluginListTypeToCTypeUpdate. For v14, it is disabled, as the list_type field is no longer available and the DB query could result in an exception. The TSconfig NewContentElement.tsconfig is removed because configuration can be done entirely in TCA. References to list_type are changed to CType in the Flexform. Resolves: #868 Related: #871
1 parent dd4db2d commit a730f9f

4 files changed

Lines changed: 49 additions & 170 deletions

File tree

Classes/EventListener/PreviewRenderingEventListener.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ public function __invoke(PageContentPreviewRenderingEvent $event): void
3232
$record = $record->toArray();
3333
}
3434

35-
/* keep v13 compatibility */
36-
$listTypeField = isset($record['list_type']) ? 'list_type' : 'CType';
35+
/* We assume migration to CType has been completed */
36+
$listTypeField = 'CType';
3737

3838
if (!str_starts_with($record[$listTypeField] ?? '', 'calendarize_')) {
3939
return;

Classes/Updates/PluginUpdater.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,14 @@
99
use TYPO3\CMS\Core\Database\Connection;
1010
use TYPO3\CMS\Core\Database\Query\QueryBuilder;
1111
use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction;
12+
use TYPO3\CMS\Core\Information\Typo3Version;
1213
use TYPO3\CMS\Core\Utility\GeneralUtility;
1314
use TYPO3\CMS\Install\Updates\DatabaseUpdatedPrerequisite;
1415

16+
/**
17+
* This Upgrade wizard should have already been run previously. It will no longer work in TYPO3 v14 because
18+
* the tt_content.list_type database field is missing. In TYPO3 v13, it should run before PluginListTypeToCTypeUpdate.
19+
*/
1520
#[UpgradeWizard('calendarize_pluginUpdater')]
1621
class PluginUpdater extends AbstractUpdate
1722
{
@@ -42,6 +47,7 @@ public function __construct(
4247
protected readonly QueryBuilder $contentElementsQueryBuilder,
4348
protected readonly QueryBuilder $backendGroupsQueryBuilder,
4449
protected readonly FlexFormTools $flexFormTools,
50+
protected readonly Typo3Version $typo3Version
4551
) {}
4652

4753
/**
@@ -260,6 +266,10 @@ protected function getNewListTypesForGroupPermissions(): string
260266

261267
public function updateNecessary(): bool
262268
{
269+
// in TYPO3 v14 it is no longer possible to perform this wizard as the list_type field is missing!
270+
if ($this->typo3Version->getMajorVersion() >= 14) {
271+
return false;
272+
}
263273
return \count($this->getContentElementsToMigrate()) > 0 || \count($this->getBackendUserGroupsToMigrate()) > 0;
264274
}
265275

Configuration/FlexForms/Calendar.xml

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@
3030
<label>LLL:EXT:calendarize/Resources/Private/Language/locallang.xlf:limit</label>
3131
<displayCond>
3232
<OR>
33-
<numIndex index="0">FIELD:parentRec.list_type:=:calendarize_listdetail</numIndex>
34-
<numIndex index="1">FIELD:parentRec.list_type:=:calendarize_list</numIndex>
35-
<numIndex index="2">FIELD:parentRec.list_type:=:calendarize_latest</numIndex>
36-
<numIndex index="3">FIELD:parentRec.list_type:=:calendarize_past</numIndex>
33+
<numIndex index="0">FIELD:parentRec.CType:=:calendarize_listdetail</numIndex>
34+
<numIndex index="1">FIELD:parentRec.CType:=:calendarize_list</numIndex>
35+
<numIndex index="2">FIELD:parentRec.CType:=:calendarize_latest</numIndex>
36+
<numIndex index="3">FIELD:parentRec.CType:=:calendarize_past</numIndex>
3737
</OR>
3838
</displayCond>
3939
<config>
@@ -46,7 +46,7 @@
4646

4747
<settings.singleItems>
4848
<label>LLL:EXT:calendarize/Resources/Private/Language/locallang.xlf:singleItems</label>
49-
<displayCond>FIELD:parentRec.list_type:=:calendarize_single</displayCond>
49+
<displayCond>FIELD:parentRec.CType:=:calendarize_single</displayCond>
5050
<config>
5151
<type>group</type>
5252
<allowed>*</allowed>
@@ -59,11 +59,11 @@
5959
<label>LLL:EXT:calendarize/Resources/Private/Language/locallang.xlf:hide.pagination.teaser</label>
6060
<displayCond>
6161
<OR>
62-
<numIndex index="0">FIELD:parentRec.list_type:=:calendarize_listdetail</numIndex>
63-
<numIndex index="1">FIELD:parentRec.list_type:=:calendarize_list</numIndex>
64-
<numIndex index="2">FIELD:parentRec.list_type:=:calendarize_latest</numIndex>
65-
<numIndex index="3">FIELD:parentRec.list_type:=:calendarize_result</numIndex>
66-
<numIndex index="4">FIELD:parentRec.list_type:=:calendarize_past</numIndex>
62+
<numIndex index="0">FIELD:parentRec.CType:=:calendarize_listdetail</numIndex>
63+
<numIndex index="1">FIELD:parentRec.CType:=:calendarize_list</numIndex>
64+
<numIndex index="2">FIELD:parentRec.CType:=:calendarize_latest</numIndex>
65+
<numIndex index="3">FIELD:parentRec.CType:=:calendarize_result</numIndex>
66+
<numIndex index="4">FIELD:parentRec.CType:=:calendarize_past</numIndex>
6767
</OR>
6868
</displayCond>
6969
<config>
@@ -76,12 +76,12 @@
7676
<displayCond>
7777
<OR>
7878

79-
<numIndex index="0">FIELD:parentRec.list_type:=:calendarize_listdetail</numIndex>
80-
<numIndex index="1">FIELD:parentRec.list_type:=:calendarize_list</numIndex>
81-
<numIndex index="2">FIELD:parentRec.list_type:=:calendarize_latest</numIndex>
82-
<numIndex index="3">FIELD:parentRec.list_type:=:calendarize_result</numIndex>
83-
<numIndex index="4">FIELD:parentRec.list_type:=:calendarize_detail</numIndex>
84-
<!-- <numIndex index="5">FIELD:parentRec.list_type:=:calendarize_past</numIndex> -->
79+
<numIndex index="0">FIELD:parentRec.CType:=:calendarize_listdetail</numIndex>
80+
<numIndex index="1">FIELD:parentRec.CType:=:calendarize_list</numIndex>
81+
<numIndex index="2">FIELD:parentRec.CType:=:calendarize_latest</numIndex>
82+
<numIndex index="3">FIELD:parentRec.CType:=:calendarize_result</numIndex>
83+
<numIndex index="4">FIELD:parentRec.CType:=:calendarize_detail</numIndex>
84+
<!-- <numIndex index="5">FIELD:parentRec.CType:=:calendarize_past</numIndex> -->
8585
</OR>
8686
</displayCond>
8787
<config>
@@ -93,9 +93,9 @@
9393
<label>LLL:EXT:calendarize/Resources/Private/Language/locallang.xlf:useRelativeDate</label>
9494
<displayCond>
9595
<OR>
96-
<numIndex index="0">FIELD:parentRec.list_type:=:calendarize_listdetail</numIndex>
97-
<numIndex index="1">FIELD:parentRec.list_type:=:calendarize_list</numIndex>
98-
<numIndex index="2">FIELD:parentRec.list_type:=:calendarize_latest</numIndex>
96+
<numIndex index="0">FIELD:parentRec.CType:=:calendarize_listdetail</numIndex>
97+
<numIndex index="1">FIELD:parentRec.CType:=:calendarize_list</numIndex>
98+
<numIndex index="2">FIELD:parentRec.CType:=:calendarize_latest</numIndex>
9999
</OR>
100100
</displayCond>
101101
<onChange>reload</onChange>
@@ -109,9 +109,9 @@
109109
<AND>
110110
<numIndex index="0">FIELD:settings.useRelativeDate:REQ:false</numIndex>
111111
<OR>
112-
<numIndex index="0">FIELD:parentRec.list_type:=:calendarize_listdetail</numIndex>
113-
<numIndex index="1">FIELD:parentRec.list_type:=:calendarize_list</numIndex>
114-
<numIndex index="2">FIELD:parentRec.list_type:=:calendarize_latest</numIndex>
112+
<numIndex index="0">FIELD:parentRec.CType:=:calendarize_listdetail</numIndex>
113+
<numIndex index="1">FIELD:parentRec.CType:=:calendarize_list</numIndex>
114+
<numIndex index="2">FIELD:parentRec.CType:=:calendarize_latest</numIndex>
115115
</OR>
116116
</AND>
117117
</displayCond>
@@ -125,9 +125,9 @@
125125
<AND>
126126
<numIndex index="0">FIELD:settings.useRelativeDate:REQ:false</numIndex>
127127
<OR>
128-
<numIndex index="0">FIELD:parentRec.list_type:=:calendarize_listdetail</numIndex>
129-
<numIndex index="1">FIELD:parentRec.list_type:=:calendarize_list</numIndex>
130-
<numIndex index="2">FIELD:parentRec.list_type:=:calendarize_latest</numIndex>
128+
<numIndex index="0">FIELD:parentRec.CType:=:calendarize_listdetail</numIndex>
129+
<numIndex index="1">FIELD:parentRec.CType:=:calendarize_list</numIndex>
130+
<numIndex index="2">FIELD:parentRec.CType:=:calendarize_latest</numIndex>
131131
</OR>
132132
</AND>
133133
</displayCond>
@@ -141,9 +141,9 @@
141141
<AND>
142142
<numIndex index="0">FIELD:settings.useRelativeDate:REQ:true</numIndex>
143143
<OR>
144-
<numIndex index="0">FIELD:parentRec.list_type:=:calendarize_listdetail</numIndex>
145-
<numIndex index="1">FIELD:parentRec.list_type:=:calendarize_list</numIndex>
146-
<numIndex index="2">FIELD:parentRec.list_type:=:calendarize_latest</numIndex>
144+
<numIndex index="0">FIELD:parentRec.CType:=:calendarize_listdetail</numIndex>
145+
<numIndex index="1">FIELD:parentRec.CType:=:calendarize_list</numIndex>
146+
<numIndex index="2">FIELD:parentRec.CType:=:calendarize_latest</numIndex>
147147
</OR>
148148
</AND>
149149
</displayCond>
@@ -158,9 +158,9 @@
158158
<AND>
159159
<numIndex index="0">FIELD:settings.useRelativeDate:REQ:true</numIndex>
160160
<OR>
161-
<numIndex index="0">FIELD:parentRec.list_type:=:calendarize_listdetail</numIndex>
162-
<numIndex index="1">FIELD:parentRec.list_type:=:calendarize_list</numIndex>
163-
<numIndex index="2">FIELD:parentRec.list_type:=:calendarize_latest</numIndex>
161+
<numIndex index="0">FIELD:parentRec.CType:=:calendarize_listdetail</numIndex>
162+
<numIndex index="1">FIELD:parentRec.CType:=:calendarize_list</numIndex>
163+
<numIndex index="2">FIELD:parentRec.CType:=:calendarize_latest</numIndex>
164164
</OR>
165165
</AND>
166166
</displayCond>
@@ -189,7 +189,7 @@
189189
<minitems>1</minitems>
190190
<maxitems>99</maxitems>
191191
</config>
192-
<displayCond>FIELD:parentRec.list_type:!IN:calendarize_detail</displayCond>
192+
<displayCond>FIELD:parentRec.CType:!IN:calendarize_detail</displayCond>
193193
</settings.configuration>
194194

195195
<!-- Category Mode -->
@@ -215,7 +215,7 @@
215215
</items>
216216
<default>or</default>
217217
</config>
218-
<displayCond>FIELD:parentRec.list_type:!IN:calendarize_detail,calendarize_search,calendarize_result,calendarize_single</displayCond>
218+
<displayCond>FIELD:parentRec.CType:!IN:calendarize_detail,calendarize_search,calendarize_result,calendarize_single</displayCond>
219219
</settings.categoryConjunction>
220220

221221
<!-- Calendar configuration -->
@@ -239,7 +239,7 @@
239239
</numIndex>
240240
</items>
241241
</config>
242-
<displayCond>FIELD:parentRec.list_type:!=:calendarize_detail</displayCond>
242+
<displayCond>FIELD:parentRec.CType:!=:calendarize_detail</displayCond>
243243
</settings.sortBy>
244244

245245
<!-- Calendar configuration -->
@@ -259,7 +259,7 @@
259259
</numIndex>
260260
</items>
261261
</config>
262-
<displayCond>FIELD:parentRec.list_type:!=:calendarize_detail</displayCond>
262+
<displayCond>FIELD:parentRec.CType:!=:calendarize_detail</displayCond>
263263
</settings.sorting>
264264

265265
<!-- startingpoint -->
@@ -272,7 +272,7 @@
272272
<maxitems>50</maxitems>
273273
<minitems>0</minitems>
274274
</config>
275-
<displayCond>FIELD:parentRec.list_type:!IN:calendarize_detail,calendarize_single</displayCond>
275+
<displayCond>FIELD:parentRec.CType:!IN:calendarize_detail,calendarize_single</displayCond>
276276
</persistence.storagePid>
277277

278278
<!-- recursive -->
@@ -312,7 +312,7 @@
312312
</numIndex>
313313
</items>
314314
</config>
315-
<displayCond>FIELD:parentRec.list_type:!IN:calendarize_detail,calendarize_single</displayCond>
315+
<displayCond>FIELD:parentRec.CType:!IN:calendarize_detail,calendarize_single</displayCond>
316316
</persistence.recursive>
317317
</el>
318318
</ROOT>

Configuration/TsConfig/Page/Mod/Wizards/NewContentElement.tsconfig

Lines changed: 0 additions & 131 deletions
This file was deleted.

0 commit comments

Comments
 (0)