Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TASK] Allow installation in TYPO3 v13 instances #407

Merged
merged 2 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace WebVision\Deepltranslate\Core\Widgets;
namespace WebVision\Deepltranslate\Core\Core12\Widgets;

use TYPO3\CMS\Core\Localization\LanguageService;
use TYPO3\CMS\Core\Utility\GeneralUtility;
Expand All @@ -11,6 +11,12 @@
use TYPO3\CMS\Fluid\View\StandaloneView;
use WebVision\Deepltranslate\Core\Service\UsageService;

/**
* `EXT:dashboard` widget compatible with TYPO3 v12 to display deepl api usage.
*
* @internal implementation only and not part of public API.
* @todo Remove this class when TYPO3 v12 support is dropped along with registration in {@see Configuration/Services.php}.
*/
class UsageWidget implements WidgetInterface
{
private WidgetConfigurationInterface $configuration;
Expand Down
39 changes: 24 additions & 15 deletions Configuration/Services.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
use TYPO3\CMS\Core\DependencyInjection\SingletonPass;
use TYPO3\CMS\Core\Information\Typo3Version;
use TYPO3\CMS\Dashboard\WidgetRegistry;
use WebVision\Deepltranslate\Core\Core12\Widgets\UsageWidget as Core12UsageWidget;
use WebVision\Deepltranslate\Core\Form\Item\SiteConfigSupportedLanguageItemsProcFunc;
use WebVision\Deepltranslate\Core\Form\User\HasFormalitySupport;
use WebVision\Deepltranslate\Core\Hooks\TranslateHook;
use WebVision\Deepltranslate\Core\Widgets\UsageWidget;

return function (ContainerConfigurator $containerConfigurator, ContainerBuilder $containerBuilder) {
$typo3version = new Typo3Version();
$services = $containerConfigurator
->services();

Expand All @@ -37,19 +39,26 @@
* Registration directly in Services.yaml will break without EXT:dashboard installed!
*/
if ($containerBuilder->hasDefinition(WidgetRegistry::class)) {
$services->set('widgets.deepltranslate.widget.useswidget')
->class(UsageWidget::class)
->arg('$view', new Reference('dashboard.views.widget'))
->arg('$options', [])
->tag('dashboard.widget', [
'identifier' => 'widgets-deepl-uses',
'groupNames' => 'deepl',
'title' => 'LLL:EXT:deepltranslate_core/Resources/Private/Language/locallang.xlf:widgets.deepltranslate.widget.useswidget.title',
'description' => 'LLL:EXT:deepltranslate_core/Resources/Private/Language/locallang.xlf:widgets.deepltranslate.widget.useswidget.description',
'iconIdentifier' => 'content-widget-list',
'height' => 'small',
'width' => 'small',
])
;
if ($typo3version->getMajorVersion() >= 13) {
// @todo Register TYPO3 v13 compatible UsageWidget implementation. (StandaloneView => ViewFactory)
}
/**
* @todo Remove core12 usage widget when TYPO3 v12 support is removed along with {@see Core11UsageWidget}.
*/
if ($typo3version->getMajorVersion() === 12) {
$services->set('widgets.deepltranslate.widget.useswidget')
->class(Core12UsageWidget::class)
->arg('$view', new Reference('dashboard.views.widget'))
->arg('$options', [])
->tag('dashboard.widget', [
'identifier' => 'widgets-deepl-uses',
'groupNames' => 'deepl',
'title' => 'LLL:EXT:deepltranslate_core/Resources/Private/Language/locallang.xlf:widgets.deepltranslate.widget.useswidget.title',
'description' => 'LLL:EXT:deepltranslate_core/Resources/Private/Language/locallang.xlf:widgets.deepltranslate.widget.useswidget.description',
'iconIdentifier' => 'content-widget-list',
'height' => 'small',
'width' => 'small',
]);
}
}
};
40 changes: 20 additions & 20 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@
"ext-json": "*",
"ext-pdo": "*",
"deeplcom/deepl-php": ">=1.6.0 <=1.8.0",
"typo3/cms-backend": "^12.4.2",
"typo3/cms-core": "^12.4.2",
"typo3/cms-extbase": "^12.4.2",
"typo3/cms-fluid": "^12.4.2",
"typo3/cms-install": "^12.4.2",
"typo3/cms-scheduler": "^12.4.2",
"typo3/cms-setup": "^12.4.2"
"typo3/cms-backend": "^12.4.2 || ^13.4",
"typo3/cms-core": "^12.4.2 || ^13.4",
"typo3/cms-extbase": "^12.4.2 || ^13.4",
"typo3/cms-fluid": "^12.4.2 || ^13.4",
"typo3/cms-install": "^12.4.2 || ^13.4",
"typo3/cms-scheduler": "^12.4.2 || ^13.4",
"typo3/cms-setup": "^12.4.2 || ^13.4"
},
"require-dev": {
"b13/container": "^2.2",
Expand All @@ -97,19 +97,19 @@
"phpunit/phpunit": "^10.5",
"ramsey/uuid": "^4.2",
"saschaegerer/phpstan-typo3": "^1.9",
"sbuerk/typo3-cms-styleguide-version-sync": "^12",
"typo3/cms-belog": "^12.4.2",
"typo3/cms-dashboard": "^12.4.2",
"typo3/cms-extensionmanager": "^12.4.2",
"typo3/cms-filelist": "^12.4.2",
"typo3/cms-fluid-styled-content": "^12.4.2",
"typo3/cms-frontend": "^12.4.2",
"typo3/cms-info": "^12.4.2",
"typo3/cms-lowlevel": "^12.4.2",
"typo3/cms-rte-ckeditor": "^12.4.2",
"typo3/cms-styleguide": "^12.0.5",
"typo3/cms-tstemplate": "^12.4.2",
"typo3/cms-workspaces": "^12.4.2",
"sbuerk/typo3-styleguide-selector": "^12.0.5 || ^13.4",
"typo3/cms-belog": "^12.4.2 || ^13.4",
"typo3/cms-dashboard": "^12.4.2 || ^13.4",
"typo3/cms-extensionmanager": "^12.4.2 || ^13.4",
"typo3/cms-filelist": "^12.4.2 || ^13.4",
"typo3/cms-fluid-styled-content": "^12.4.2 || ^13.4",
"typo3/cms-frontend": "^12.4.2 || ^13.4",
"typo3/cms-info": "^12.4.2 || ^13.4",
"typo3/cms-lowlevel": "^12.4.2 || ^13.4",
"typo3/cms-rte-ckeditor": "^12.4.2 || ^13.4",
"typo3/cms-styleguide": "^12.0.5 || ^13.4",
"typo3/cms-tstemplate": "^12.4.2 || ^13.4",
"typo3/cms-workspaces": "^12.4.2 || ^13.4",
"typo3/testing-framework": "^8.2.7",
"web-vision/contribution": "@dev"
},
Expand Down