Skip to content

Commit 0d6c7e7

Browse files
calien666sbuerk
authored andcommitted
[BUGFIX] Add support for nested EXT:gridelements
With `gridelements` installed the extension internal override of the DatabaseRecordList won't work anymore, as `gridelements` overrides the same way. This commit adjusts the implementation by overriding the respective class depending on installed extension `gridelements` extension and respecting the setting, if the nested content element support is enabled. As `gridelements` has no public available repository for TYPO3 13, assume this workflow works in 13.
1 parent 8e0c6fc commit 0d6c7e7

File tree

10 files changed

+74
-28
lines changed

10 files changed

+74
-28
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?php
2+
3+
// avoiding phpstan errors, as extension is not loaded and therefore not in DI list
4+
class_alias('TYPO3\\CMS\\Backend\\RecordList\\DatabaseRecordList', 'GridElementsTeam\\Gridelements\\Xclass\\DatabaseRecordList');

Build/phpstan/Core12/phpstan-baseline.neon

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,14 @@ parameters:
2626
path: ../../../Classes/Override/CommandMapPostProcessingHook.php
2727

2828
-
29-
message: "#^Method WebVision\\\\Deepltranslate\\\\Core\\\\Override\\\\Core12\\\\DatabaseRecordList\\:\\:makeLocalizationPanel\\(\\) has parameter \\$translations with no value type specified in iterable type array\\.$#"
29+
message: "#^Method WebVision\\\\Deepltranslate\\\\Core\\\\Override\\\\Core12\\\\DatabaseRecordListCore\\:\\:makeLocalizationPanel\\(\\) has parameter \\$translations with no value type specified in iterable type array\\.$#"
3030
count: 1
31-
path: ../../../Classes/Override/Core12/DatabaseRecordList.php
31+
path: ../../../Classes/Override/Core12/DatabaseRecordListCore.php
32+
33+
-
34+
message: "#^Method WebVision\\\\Deepltranslate\\\\Core\\\\Override\\\\Core12\\\\DatabaseRecordListWithGridelements\\:\\:makeLocalizationPanel\\(\\) has parameter \\$translations with no value type specified in iterable type array\\.$#"
35+
count: 1
36+
path: ../../../Classes/Override/Core12/DatabaseRecordListWithGridelements.php
3237

3338
-
3439
message: "#^Method WebVision\\\\Deepltranslate\\\\Core\\\\Override\\\\LocalizationController\\:\\:process\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#"

Build/phpstan/Core12/phpstan.neon

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
11
includes:
2-
- ../../../.Build/vendor/saschaegerer/phpstan-typo3/extension.neon
3-
- phpstan-baseline.neon
2+
- ../../../.Build/vendor/saschaegerer/phpstan-typo3/extension.neon
3+
- phpstan-baseline.neon
44

55
parameters:
6-
# Use local .cache dir instead of /tmp
7-
tmpDir: ../../../.cache/phpstan
6+
# Use local .cache dir instead of /tmp
7+
tmpDir: ../../../.cache/phpstan
8+
level: 8
89

9-
level: 8
10+
paths:
11+
- ../../../Classes/
12+
- ../../../Tests/
1013

11-
paths:
12-
- ../../../Classes/
13-
- ../../../Tests/
14+
excludePaths:
15+
- ../../../.Build/*
16+
- ../../../Tests/Functional/Updates/Fixtures/Extension/test_extension/ext_emconf.php
17+
- ../../../Tests/Functional/Fixtures/Extensions/test_services_override/ext_emconf.php
18+
- ../../../Tests/Functional/Fixtures/Extensions/testing_framework_backenduserhandler_replacement/ext_emconf.php
19+
bootstrapFiles:
20+
- classAliasses.php
1421

15-
excludePaths:
16-
- ../../../.Build/*
17-
- ../../../Tests/Functional/Updates/Fixtures/Extension/test_extension/ext_emconf.php
18-
- ../../../Tests/Functional/Fixtures/Extensions/test_services_override/ext_emconf.php
19-
- ../../../Tests/Functional/Fixtures/Extensions/testing_framework_backenduserhandler_replacement/ext_emconf.php
20-
21-
typo3:
22-
contextApiGetAspectMapping:
23-
'frontend.preview': TYPO3\CMS\Frontend\Aspect\PreviewAspect
24-
requestGetAttributeMapping:
25-
'typo3.testing.context': TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequestContext
22+
typo3:
23+
contextApiGetAspectMapping:
24+
'frontend.preview': TYPO3\CMS\Frontend\Aspect\PreviewAspect
25+
requestGetAttributeMapping:
26+
'typo3.testing.context': TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequestContext
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?php
2+
3+
// avoiding phpstan errors, as extension is not loaded and therefore not in DI list
4+
class_alias('TYPO3\\CMS\\Backend\\RecordList\\DatabaseRecordList', 'GridElementsTeam\\Gridelements\\Xclass\\DatabaseRecordList');

Build/phpstan/Core13/phpstan-baseline.neon

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,14 @@ parameters:
3131
path: ../../../Classes/Override/CommandMapPostProcessingHook.php
3232

3333
-
34-
message: "#^Method WebVision\\\\Deepltranslate\\\\Core\\\\Override\\\\Core12\\\\DatabaseRecordList\\:\\:makeLocalizationPanel\\(\\) has parameter \\$translations with no value type specified in iterable type array\\.$#"
34+
message: "#^Method WebVision\\\\Deepltranslate\\\\Core\\\\Override\\\\Core12\\\\DatabaseRecordListCore\\:\\:makeLocalizationPanel\\(\\) has parameter \\$translations with no value type specified in iterable type array\\.$#"
3535
count: 1
36-
path: ../../../Classes/Override/Core12/DatabaseRecordList.php
36+
path: ../../../Classes/Override/Core12/DatabaseRecordListCore.php
37+
38+
-
39+
message: "#^Method WebVision\\\\Deepltranslate\\\\Core\\\\Override\\\\Core12\\\\DatabaseRecordListWithGridelements\\:\\:makeLocalizationPanel\\(\\) has parameter \\$translations with no value type specified in iterable type array\\.$#"
40+
count: 1
41+
path: ../../../Classes/Override/Core12/DatabaseRecordListWithGridelements.php
3742

3843
-
3944
message: "#^Method WebVision\\\\Deepltranslate\\\\Core\\\\Override\\\\LocalizationController\\:\\:process\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#"

Build/phpstan/Core13/phpstan.neon

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ parameters:
1717
- ../../../Tests/Functional/Updates/Fixtures/Extension/test_extension/ext_emconf.php
1818
- ../../../Tests/Functional/Fixtures/Extensions/test_services_override/ext_emconf.php
1919
- ../../../Tests/Functional/Fixtures/Extensions/testing_framework_backenduserhandler_replacement/ext_emconf.php
20-
20+
bootstrapFiles:
21+
- classAliasses.php
2122
typo3:
2223
contextApiGetAspectMapping:
2324
'frontend.preview': TYPO3\CMS\Frontend\Aspect\PreviewAspect

Classes/Override/Core12/DatabaseRecordList.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* @internal
1515
* @override
1616
*/
17-
class DatabaseRecordList extends \TYPO3\CMS\Backend\RecordList\DatabaseRecordList
17+
trait DatabaseRecordList
1818
{
1919
/**
2020
* Creates the localization panel
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace WebVision\Deepltranslate\Core\Override\Core12;
6+
7+
class DatabaseRecordListCore extends \TYPO3\CMS\Backend\RecordList\DatabaseRecordList
8+
{
9+
use DatabaseRecordList;
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace WebVision\Deepltranslate\Core\Override\Core12;
6+
7+
class DatabaseRecordListWithGridelements extends \GridElementsTeam\Gridelements\Xclass\DatabaseRecordList
8+
{
9+
use DatabaseRecordList;
10+
}

ext_localconf.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,15 @@
2929
];
3030

3131
//xclass databaserecordlist for rendering custom checkboxes to toggle deepl selection in recordlist
32-
$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects'][\TYPO3\CMS\Backend\RecordList\DatabaseRecordList::class] = [
33-
'className' => \WebVision\Deepltranslate\Core\Override\Core12\DatabaseRecordList::class,
34-
];
32+
if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('gridelements') && !empty($GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['gridelements']['nestingInListModule'])) {
33+
$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects'][\TYPO3\CMS\Backend\RecordList\DatabaseRecordList::class] = [
34+
'className' => \WebVision\Deepltranslate\Core\Override\Core12\DatabaseRecordListWithGridelements::class,
35+
];
36+
} else {
37+
$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects'][\TYPO3\CMS\Backend\RecordList\DatabaseRecordList::class] = [
38+
'className' => \WebVision\Deepltranslate\Core\Override\Core12\DatabaseRecordListCore::class,
39+
];
40+
}
3541

3642
if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('container')) {
3743
//xclass CommandMapPostProcessingHook for translating contents within containers

0 commit comments

Comments
 (0)