From 9571af6c8d0e7090395bf1d021739829314a40ff Mon Sep 17 00:00:00 2001 From: Kevin Ditscheid Date: Thu, 4 Nov 2021 13:47:31 +0100 Subject: [PATCH 1/6] [BUGFIX] Change the configuration to make dashboard widget optiional --- Configuration/Services.php | 28 ++++++++++++++++++++++++++++ Configuration/Services.yaml | 13 ------------- 2 files changed, 28 insertions(+), 13 deletions(-) create mode 100644 Configuration/Services.php diff --git a/Configuration/Services.php b/Configuration/Services.php new file mode 100644 index 0000000..f20325a --- /dev/null +++ b/Configuration/Services.php @@ -0,0 +1,28 @@ +services(); + + if ($containerBuilder->hasDefinition(WidgetInterface::class)) { + $services->set('widgets.dashboard.widget.clockWidget') + ->class(TheCodingOwl\Oclock\Widgets\ClockWidget::class) + ->arg('$view', new Reference('dashboard.views.widget')) + ->tag('dashboard.widget', [ + 'identifier' => 'theCodingOwlClock', + 'groupNames' => 'systemInfo', + 'title' => 'Clock Widget', + 'description' => 'Displays a clock', + 'iconIdentifier' => 'the-coding-owl-clock', + 'height' => 'medium', + 'width' => 'medium' + ]); + } +}; \ No newline at end of file diff --git a/Configuration/Services.yaml b/Configuration/Services.yaml index 5241aff..e0a6a97 100644 --- a/Configuration/Services.yaml +++ b/Configuration/Services.yaml @@ -3,16 +3,3 @@ services: autowire: true autoconfigure: true public: false - dashboard.widget.custom: - class: 'TheCodingOwl\Oclock\Widgets\ClockWidget' - arguments: - $view: '@dashboard.views.widget' - tags: - - name: dashboard.widget - identifier: theCodingOwlClock - groupNames: 'systemInfo' - title: 'Clock Widget' - description: 'Displays a clock' - iconIdentifier: 'the-coding-owl-clock' - height: 'medium' - width: 'medium' From b20e4a88b29e6f52e3ed9fdb7d097b37930caa3d Mon Sep 17 00:00:00 2001 From: Kevin Ditscheid Date: Fri, 5 Nov 2021 22:20:26 +0100 Subject: [PATCH 2/6] [TASK] Add resource to Services.yaml --- Configuration/Services.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Configuration/Services.yaml b/Configuration/Services.yaml index e0a6a97..9ea5d46 100644 --- a/Configuration/Services.yaml +++ b/Configuration/Services.yaml @@ -3,3 +3,6 @@ services: autowire: true autoconfigure: true public: false + + TheCodingOwl\Oclock\: + resource: '../Classes/*' From 050abe9b6e58edeabb9f6b328650f29082664929 Mon Sep 17 00:00:00 2001 From: Kevin Ditscheid Date: Fri, 5 Nov 2021 22:20:42 +0100 Subject: [PATCH 3/6] [TASK] Use new Icon API --- Configuration/Icons.php | 7 +++++++ ext_localconf.php | 22 ++++++++++++++-------- 2 files changed, 21 insertions(+), 8 deletions(-) create mode 100644 Configuration/Icons.php diff --git a/Configuration/Icons.php b/Configuration/Icons.php new file mode 100644 index 0000000..2a4b428 --- /dev/null +++ b/Configuration/Icons.php @@ -0,0 +1,7 @@ + [ + 'provider' => \TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class, + 'source' => 'EXT:oclock/Resources/Public/Icons/clock.svg' + ] +]; \ No newline at end of file diff --git a/ext_localconf.php b/ext_localconf.php index a91cd0c..2517a08 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -1,13 +1,19 @@ registerIcon( - 'the-coding-owl-clock', - \TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class, - [ - 'source' => 'EXT:oclock/Resources/Public/Icons/clock.svg' - ] - ); + if (version_compare(VersionNumberUtility::getCurrentTypo3Version(), '11.4.0', '<')) { + $iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( + \TYPO3\CMS\Core\Imaging\IconRegistry::class + ); + $iconRegistry->registerIcon( + 'the-coding-owl-clock', + \TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class, + [ + 'source' => 'EXT:oclock/Resources/Public/Icons/clock.svg' + ] + ); + } }, 'oclock'); From 61f2e92d5dc478a88d868fbfec67fee6d1f9ebb5 Mon Sep 17 00:00:00 2001 From: Kevin Ditscheid Date: Fri, 5 Nov 2021 22:21:02 +0100 Subject: [PATCH 4/6] [TASK] Update code quality tools --- composer.json | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index e471766..f609139 100644 --- a/composer.json +++ b/composer.json @@ -39,9 +39,11 @@ "typo3-ter/oclock": "self.version" }, "require-dev": { - "phpstan/phpstan": "^0.12.18", - "saschaegerer/phpstan-typo3": "^0.13.1", - "phpstan/extension-installer": "^1.0", - "squizlabs/php_codesniffer": "^3.5" + "phpstan/phpstan": "^1.0.1", + "saschaegerer/phpstan-typo3": "^1.0.0", + "phpstan/extension-installer": "^1.1.0", + "squizlabs/php_codesniffer": "^3.6.1", + "roave/security-advisories": "dev-master", + "friendsofphp/php-cs-fixer": "^3.2" } } From 4fc2f301d17397dd3a32fcc315f4666b6cd22f60 Mon Sep 17 00:00:00 2001 From: Kevin Ditscheid Date: Fri, 5 Nov 2021 22:29:31 +0100 Subject: [PATCH 5/6] [TASK] Add extension-key to composer.json --- composer.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/composer.json b/composer.json index f609139..9b07e07 100644 --- a/composer.json +++ b/composer.json @@ -45,5 +45,10 @@ "squizlabs/php_codesniffer": "^3.6.1", "roave/security-advisories": "dev-master", "friendsofphp/php-cs-fixer": "^3.2" + }, + "extra": { + "typo3/cms": { + "extension-key": "oclock" + } } } From f85178d61fa28db6c9575bd6114fa4e122ab7946 Mon Sep 17 00:00:00 2001 From: Kevin Ditscheid Date: Sat, 6 Nov 2021 15:45:08 +0100 Subject: [PATCH 6/6] [TASK] Fix phpstan issues --- Classes/Toolbar/Clock.php | 1 + Classes/Widgets/ClockWidget.php | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Classes/Toolbar/Clock.php b/Classes/Toolbar/Clock.php index d5d14c8..c1efe24 100644 --- a/Classes/Toolbar/Clock.php +++ b/Classes/Toolbar/Clock.php @@ -32,6 +32,7 @@ public function __construct() $this->view = GeneralUtility::makeInstance(StandaloneView::class); /** @var ExtensionConfiguration $extensionConfiguration */ $extensionConfiguration = GeneralUtility::makeInstance(ExtensionConfiguration::class); + /** @var array{dashboard:string[],additionalTemplateRootPath:string,additionalPartialRootPath:string,additionalLayoutRootPath:string} $extConf */ $extConf = $extensionConfiguration->get('oclock'); $rootPaths = [ 'template' => [ diff --git a/Classes/Widgets/ClockWidget.php b/Classes/Widgets/ClockWidget.php index a4eb948..98f16df 100644 --- a/Classes/Widgets/ClockWidget.php +++ b/Classes/Widgets/ClockWidget.php @@ -78,14 +78,18 @@ class ClockWidget implements WidgetInterface, RequireJsModuleInterface, Addition /** * Constructor of the ClockWidget * - * @var StandaloneView $view + * @param StandaloneView $view */ public function __construct(StandaloneView $view) { $this->view = $view; /** @var ExtensionConfiguration $extensionConfiguration */ $extensionConfiguration = GeneralUtility::makeInstance(ExtensionConfiguration::class); - $this->extConf = $extensionConfiguration->get('oclock'); + /** @var array{dashboard:string[],additionalTemplateRootPath:string,additionalPartialRootPath:string,additionalLayoutRootPath:string} $extConf */ + $extConf = $extensionConfiguration->get('oclock'); + if (is_array($extConf)) { + $this->extConf = $extConf; + } } /**