From 6beae6f7b34ba856de052a37638ab44f1b736076 Mon Sep 17 00:00:00 2001 From: Robin Krahnen Date: Tue, 27 Aug 2019 09:44:49 +0200 Subject: [PATCH 01/11] allow neos/flow ~5.3 --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index bd7c901..7c3d666 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ "license": "MIT", "homepage": "https://github.com/digicomp/DigiComp.Sequence", "require": { - "neos/flow": "~4.0" + "neos/flow": "~4.0|~5.3" }, "autoload": { "psr-4": { @@ -63,4 +63,4 @@ "Neos.Flow-20170127183102" ] } -} \ No newline at end of file +} From 2d7249922af590b33942fa852992a3780bf0fb64 Mon Sep 17 00:00:00 2001 From: Robin Krahnen Date: Tue, 27 Aug 2019 11:30:13 +0200 Subject: [PATCH 02/11] TASK: Apply migration DigiComp.SettingValidator-20170603120900 Restructures Validation.yamls to new format Note: This migration did not produce any changes, so the commit simply marks the migration as applied. This makes sure it will not be applied again. --- composer.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 7c3d666..49d1014 100644 --- a/composer.json +++ b/composer.json @@ -60,7 +60,8 @@ "TYPO3.FluidAdaptor-20161130112935", "Neos.Media-20161219094126", "Neos.Flow-20170125103800", - "Neos.Flow-20170127183102" + "Neos.Flow-20170127183102", + "DigiComp.SettingValidator-20170603120900" ] } -} +} \ No newline at end of file From 892d2613c41b5fa2609a612b668c157102c2d96f Mon Sep 17 00:00:00 2001 From: Robin Krahnen Date: Tue, 27 Aug 2019 11:30:13 +0200 Subject: [PATCH 03/11] TASK: Apply migration Neos.Flow-20180415105700 Add scalar type hint to CacheAwareInterface implementations. Note: This migration did not produce any changes, so the commit simply marks the migration as applied. This makes sure it will not be applied again. --- composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 49d1014..aae41c7 100644 --- a/composer.json +++ b/composer.json @@ -61,7 +61,8 @@ "Neos.Media-20161219094126", "Neos.Flow-20170125103800", "Neos.Flow-20170127183102", - "DigiComp.SettingValidator-20170603120900" + "DigiComp.SettingValidator-20170603120900", + "Neos.Flow-20180415105700" ] } } \ No newline at end of file From ac808d34d633165c6a2e92ecf3040d987013616e Mon Sep 17 00:00:00 2001 From: Ferdinand Kuhl Date: Thu, 15 Oct 2020 14:54:05 +0200 Subject: [PATCH 04/11] TASK: Allow Neos Flow 6.3 --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index aae41c7..5c17812 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ "license": "MIT", "homepage": "https://github.com/digicomp/DigiComp.Sequence", "require": { - "neos/flow": "~4.0|~5.3" + "neos/flow": "~4.0|~5.3|~6.3" }, "autoload": { "psr-4": { @@ -65,4 +65,4 @@ "Neos.Flow-20180415105700" ] } -} \ No newline at end of file +} From 893e6b313ac487cc18ae5301bd1aff5fe4598722 Mon Sep 17 00:00:00 2001 From: Ferdinand Kuhl Date: Thu, 15 Oct 2020 21:13:20 +0200 Subject: [PATCH 05/11] FIX: First steps towards Flow 6.3 compatibility. For now only ItemsViewHelper --- Classes/ViewHelpers/ItemsViewHelper.php | 15 +++++++++++---- Classes/ViewHelpers/ProgressViewHelper.php | 1 + 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Classes/ViewHelpers/ItemsViewHelper.php b/Classes/ViewHelpers/ItemsViewHelper.php index faa92b6..23eff30 100644 --- a/Classes/ViewHelpers/ItemsViewHelper.php +++ b/Classes/ViewHelpers/ItemsViewHelper.php @@ -29,14 +29,21 @@ class ItemsViewHelper extends AbstractViewHelper */ protected $menuService; + public function initializeArguments(): void + { + $this->registerArgument('for', 'string', 'path in Menu.yaml', false); + $this->registerArgument('as', 'string', 'Name in Frontend', false); + } + /** - * @param string $as - * @param string $for * @return string */ - public function render($as = 'items', $for = null) + public function render(): string { - $this->templateVariableContainer->add($as, $this->menuService->getItems($for)); + $this->templateVariableContainer->add( + $this->arguments['as'], + $this->menuService->getItems($this->arguments['for']) + ); return $this->renderChildren(); } } diff --git a/Classes/ViewHelpers/ProgressViewHelper.php b/Classes/ViewHelpers/ProgressViewHelper.php index c59f8bd..b2023c1 100644 --- a/Classes/ViewHelpers/ProgressViewHelper.php +++ b/Classes/ViewHelpers/ProgressViewHelper.php @@ -22,6 +22,7 @@ class ProgressViewHelper extends AbstractViewHelper protected $escapeOutput = false; /** + * TODO: initializeArguments * @param array $links * @param int $activeStep * @param bool $returnable From e436e722c13ba98639d10615aaea56b48cb0e1b9 Mon Sep 17 00:00:00 2001 From: Ferdinand Kuhl Date: Wed, 12 May 2021 02:01:22 +0200 Subject: [PATCH 06/11] phpcbf run --- Classes/MenuService/ServiceInterface.php | 2 +- Classes/MenuService/SettingsService.php | 6 ++++-- Classes/Package.php | 7 ++++--- Classes/ViewHelpers/ItemsViewHelper.php | 2 +- Classes/ViewHelpers/ProgressViewHelper.php | 2 +- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Classes/MenuService/ServiceInterface.php b/Classes/MenuService/ServiceInterface.php index ae40c38..cedac82 100644 --- a/Classes/MenuService/ServiceInterface.php +++ b/Classes/MenuService/ServiceInterface.php @@ -1,4 +1,5 @@ $b['sorting']; } ); } return $items; } -} \ No newline at end of file +} diff --git a/Classes/Package.php b/Classes/Package.php index 4f9ee49..83474ff 100644 --- a/Classes/Package.php +++ b/Classes/Package.php @@ -1,4 +1,5 @@ getSignalSlotDispatcher(); $dispatcher->connect( - 'Neos\Flow\Configuration\ConfigurationManager', 'configurationManagerReady', + 'Neos\Flow\Configuration\ConfigurationManager', + 'configurationManagerReady', function (ConfigurationManager $configurationManager) { $configurationManager->registerConfigurationType('Menu'); } ); } -} \ No newline at end of file +} diff --git a/Classes/ViewHelpers/ItemsViewHelper.php b/Classes/ViewHelpers/ItemsViewHelper.php index 23eff30..59c1160 100644 --- a/Classes/ViewHelpers/ItemsViewHelper.php +++ b/Classes/ViewHelpers/ItemsViewHelper.php @@ -1,4 +1,5 @@ Date: Wed, 12 May 2021 02:26:43 +0200 Subject: [PATCH 07/11] Type hinting and no render method arguments --- Classes/MenuService/ServiceInterface.php | 4 +- Classes/MenuService/SettingsService.php | 26 ++++------ Classes/ViewHelpers/ItemsViewHelper.php | 11 +++-- Classes/ViewHelpers/ProgressViewHelper.php | 56 ++++++++++++---------- 4 files changed, 49 insertions(+), 48 deletions(-) diff --git a/Classes/MenuService/ServiceInterface.php b/Classes/MenuService/ServiceInterface.php index cedac82..f72e77a 100644 --- a/Classes/MenuService/ServiceInterface.php +++ b/Classes/MenuService/ServiceInterface.php @@ -18,9 +18,9 @@ namespace DigiComp\Menu\MenuService; interface ServiceInterface { /** - * @param mixed $forPath + * @param string|null $forPath * * @return array|\Iterator */ - public function getItems($forPath = null); + public function getItems(string $forPath = null): array; } diff --git a/Classes/MenuService/SettingsService.php b/Classes/MenuService/SettingsService.php index f01427e..5e3c814 100644 --- a/Classes/MenuService/SettingsService.php +++ b/Classes/MenuService/SettingsService.php @@ -13,7 +13,6 @@ namespace DigiComp\Menu\MenuService; */ use Neos\Flow\Annotations as Flow; -use Neos\Flow\Configuration\ConfigurationManager; /** * @package DigiComp\Menu\Menu @@ -23,33 +22,24 @@ use Neos\Flow\Configuration\ConfigurationManager; class SettingsService implements ServiceInterface { /** - * @var \Neos\Flow\Configuration\ConfigurationManager + * @Flow\InjectConfiguration(type="Menu") + * @var array */ - protected $configurationManager; - public function injectConfigurationManager(ConfigurationManager $configurationManager) - { - $this->configurationManager = $configurationManager; - $this->menuConfiguration = $this->configurationManager->getConfiguration('Menu'); - } + protected array $menuConfiguration; /** * @var array */ - protected $menuConfiguration; + protected array $items = array(); /** - * @var array - */ - protected $items = array(); - - /** - * @param string $forMenu + * @param string|null $forPath * @return array */ - public function getItems($forMenu = null) + public function getItems(string $forPath = null): array { - if ($forMenu) { - $items = &$this->menuConfiguration[$forMenu]; + if ($forPath) { + $items = &$this->menuConfiguration[$forPath]; } else { $items = &$this->menuConfiguration; } diff --git a/Classes/ViewHelpers/ItemsViewHelper.php b/Classes/ViewHelpers/ItemsViewHelper.php index 59c1160..12ed9a9 100644 --- a/Classes/ViewHelpers/ItemsViewHelper.php +++ b/Classes/ViewHelpers/ItemsViewHelper.php @@ -12,8 +12,10 @@ namespace DigiComp\Menu\ViewHelpers; * source code. */ +use DigiComp\Menu\MenuService\ServiceInterface; use Neos\Flow\Annotations as Flow; use Neos\FluidAdaptor\Core\ViewHelper\AbstractViewHelper; +use Neos\FluidAdaptor\Core\ViewHelper\Exception; /** * Just adds the return of MenuService @@ -24,11 +26,14 @@ class ItemsViewHelper extends AbstractViewHelper protected $escapeOutput = false; /** - * @var \DigiComp\Menu\MenuService\ServiceInterface * @Flow\Inject + * @var ServiceInterface */ protected $menuService; + /** + * @throws Exception + */ public function initializeArguments(): void { $this->registerArgument('for', 'string', 'path in Menu.yaml', false); @@ -36,9 +41,9 @@ class ItemsViewHelper extends AbstractViewHelper } /** - * @return string + * @return mixed */ - public function render(): string + public function render() { $this->templateVariableContainer->add( $this->arguments['as'], diff --git a/Classes/ViewHelpers/ProgressViewHelper.php b/Classes/ViewHelpers/ProgressViewHelper.php index ce5f7e4..33a7e01 100644 --- a/Classes/ViewHelpers/ProgressViewHelper.php +++ b/Classes/ViewHelpers/ProgressViewHelper.php @@ -13,6 +13,7 @@ namespace DigiComp\Menu\ViewHelpers; */ use Neos\FluidAdaptor\Core\ViewHelper\AbstractViewHelper; +use Neos\FluidAdaptor\Core\ViewHelper\Exception; /** * Helps to get useful template variables for process menus @@ -22,32 +23,37 @@ class ProgressViewHelper extends AbstractViewHelper protected $escapeOutput = false; /** - * TODO: initializeArguments - * @param array $links - * @param int $activeStep - * @param bool $returnable - * @param string $stepsAs - * @param string $backLinkAs - * @param string $activeStepAs - * @param string $linksAs - * @param string $activeStepLinkAs - * @param int $offset - * @param int $linkCount if given overrides count($links) - * - * @return string + * @throws Exception */ - public function render( - array $links, - $activeStep = 1, - $returnable = true, - $stepsAs = 'steps', - $backLinkAs = 'backLink', - $activeStepAs = 'activeStep', - $linksAs = 'links', - $activeStepLinkAs = 'activeStepLink', - $offset = 1, - $linkCount = null - ) { + public function initializeArguments(): void + { + $this->registerArgument('for', 'string', 'path in Menu.yaml', false); + $this->registerArgument('as', 'string', 'Name in Frontend', false); + $this->registerArgument('links', 'array', 'links to show', true); + $this->registerArgument('activeStep', 'int', 'current active link index', false, 1); + $this->registerArgument('returnable', 'bool', 'can you go back to the last index', false, true); + $this->registerArgument('stepsAs', 'string', 'variable name of a single step', false, 'steps'); + $this->registerArgument('backLinkAs', 'string', 'variable name of a backlink', false, 'backLink'); + $this->registerArgument('linksAs', 'string', 'variable name of the links array', false, 'links'); + $this->registerArgument( + 'activeStepLinkAs', + 'string', + 'variable name of the active step link', + false, + 'activeStepLink' + ); + $this->registerArgument('offset', 'int', 'offset to start with', false, 1); + $this->registerArgument('linkCount', 'int', 'force this number of steps', false); + } + + /** + * @return mixed + */ + public function render() + { + $links = $activeStep = $returnable = $stepsAs = $backLinkAs = $activeStepAs = $linksAs = + $activeStepLinkAs = $offset = $linkCount = null; + extract($this->arguments); //handling famous off by one $activeStep -= $offset; //make sure our array index is numeric From 27bfb049f357a7b548fd1b5181d1a30dd32e321c Mon Sep 17 00:00:00 2001 From: Ferdinand Kuhl Date: Tue, 8 Jun 2021 18:35:42 +0200 Subject: [PATCH 08/11] Adjusting interface and implementation to use \Iterator instead of array --- Classes/MenuService/ServiceInterface.php | 2 +- Classes/MenuService/SettingsService.php | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Classes/MenuService/ServiceInterface.php b/Classes/MenuService/ServiceInterface.php index f72e77a..bb3c892 100644 --- a/Classes/MenuService/ServiceInterface.php +++ b/Classes/MenuService/ServiceInterface.php @@ -22,5 +22,5 @@ interface ServiceInterface * * @return array|\Iterator */ - public function getItems(string $forPath = null): array; + public function getItems(string $forPath = null): \Iterator; } diff --git a/Classes/MenuService/SettingsService.php b/Classes/MenuService/SettingsService.php index 5e3c814..99ca0b4 100644 --- a/Classes/MenuService/SettingsService.php +++ b/Classes/MenuService/SettingsService.php @@ -32,11 +32,7 @@ class SettingsService implements ServiceInterface */ protected array $items = array(); - /** - * @param string|null $forPath - * @return array - */ - public function getItems(string $forPath = null): array + public function getItems(string $forPath = null): \Iterator { if ($forPath) { $items = &$this->menuConfiguration[$forPath]; @@ -51,6 +47,6 @@ class SettingsService implements ServiceInterface } ); } - return $items; + return new \ArrayIterator($items); } } From 6b3f24b0eeccec77ab8def35efcb28bebc90faaf Mon Sep 17 00:00:00 2001 From: Ferdinand Kuhl Date: Tue, 29 Jun 2021 13:07:25 +0200 Subject: [PATCH 09/11] Class literal instead of string and updating copyright --- Classes/Package.php | 2 +- License.txt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Classes/Package.php b/Classes/Package.php index 83474ff..dd0dd7c 100644 --- a/Classes/Package.php +++ b/Classes/Package.php @@ -27,7 +27,7 @@ class Package extends BasePackage $dispatcher = $bootstrap->getSignalSlotDispatcher(); $dispatcher->connect( - 'Neos\Flow\Configuration\ConfigurationManager', + ConfigurationManager::class, 'configurationManagerReady', function (ConfigurationManager $configurationManager) { $configurationManager->registerConfigurationType('Menu'); diff --git a/License.txt b/License.txt index 2ffa411..8b9c3be 100644 --- a/License.txt +++ b/License.txt @@ -1,4 +1,4 @@ -Copyright (c) 2016 Ferdinand Kuhl +Copyright (c) 2021 Ferdinand Kuhl Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -16,4 +16,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file +THE SOFTWARE. From 68e35595f3f53eb295eeda63a5828dc5df11a9ff Mon Sep 17 00:00:00 2001 From: Ferdinand Kuhl Date: Tue, 29 Jun 2021 13:09:07 +0200 Subject: [PATCH 10/11] Dropping old flow dependencies --- composer.json | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 5c17812..0b8604b 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "digicomp/menu", - "type": "typo3-flow-package", + "type": "neos-package", "description": "Helps with the creation of simple fluid based menus", "keywords": [ "flow", @@ -16,9 +16,10 @@ } ], "license": "MIT", - "homepage": "https://github.com/digicomp/DigiComp.Sequence", + "homepage": "https://github.com/digicomp/DigiComp.Menu", "require": { - "neos/flow": "~4.0|~5.3|~6.3" + "neos/flow": "~6.3", + "php": "^7.4" }, "autoload": { "psr-4": { From 07233f77500a174f09ff5519e0a62fea4e55d6e4 Mon Sep 17 00:00:00 2001 From: Ferdinand Kuhl Date: Thu, 26 Aug 2021 11:19:30 +0200 Subject: [PATCH 11/11] Updating branch aliases --- composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 0b8604b..deadeb0 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,8 @@ }, "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-develop": "3.0.x-dev", + "dev-version/2.x-dev": "2.0.x-dev" }, "applied-flow-migrations": [ "TYPO3.Fluid-20150214130800",