Compare commits

..

45 commits

Author SHA1 Message Date
c03377c974 update structure of composer.json and update dependencies 2024-10-11 14:30:25 +02:00
Christian Krause
f4d3da82a6 Merge branch 'release/3.0.1' 2023-05-23 17:41:23 +02:00
Christian Krause
e8ea04f323 Fix for iterator arguments 2023-05-23 17:40:07 +02:00
f54dded1e0 left over code style issues 2023-02-07 16:57:50 +01:00
b77e4f391b Only Code-Style and doc-type hints 2023-02-07 16:44:52 +01:00
Dustin Hauer
5cbd1340cd Merge branch 'version/2.x-dev' into develop
* version/2.x-dev:
2023-01-11 12:08:49 +01:00
Dustin Hauer
3a08a677bd Merge branch 'version/2.x' into version/2.x-dev
* version/2.x:
2023-01-11 12:07:40 +01:00
Dustin Hauer
bb648cee60 Merge branch 'version/2.x-dev' into version/2.x
* version/2.x-dev:
  TASK: Apply migration Neos.Flow-20180415105700
  TASK: Apply migration DigiComp.SettingValidator-20170603120900
  allow neos/flow ~5.3
2023-01-11 12:07:07 +01:00
Dustin Hauer
277835311c Merge branch 'feature/flow-5.3' into version/2.x-dev
* feature/flow-5.3:
  TASK: Apply migration Neos.Flow-20180415105700
  TASK: Apply migration DigiComp.SettingValidator-20170603120900
  allow neos/flow ~5.3
2023-01-11 12:06:34 +01:00
f32f995f43 Merge tag '3.0.0' into develop
Tagging 3.0.0
2021-08-26 11:20:06 +02:00
13206fec9a Merge branch 'release/3.0.0' 2021-08-26 11:20:02 +02:00
5baf0c080c Merge branch 'feature/flow-6.3' into develop 2021-08-26 11:19:49 +02:00
07233f7750 Updating branch aliases 2021-08-26 11:19:30 +02:00
68e35595f3 Dropping old flow dependencies 2021-06-29 13:09:07 +02:00
6b3f24b0ee Class literal instead of string and updating copyright 2021-06-29 13:07:25 +02:00
27bfb049f3 Adjusting interface and implementation to use \Iterator instead of array 2021-06-08 18:35:42 +02:00
6339e96084 Type hinting and no render method arguments 2021-05-12 02:26:43 +02:00
e436e722c1 phpcbf run 2021-05-12 02:01:22 +02:00
893e6b313a FIX: First steps towards Flow 6.3 compatibility. For now only ItemsViewHelper 2020-10-15 21:13:20 +02:00
ac808d34d6 TASK: Allow Neos Flow 6.3 2020-10-15 14:54:05 +02:00
Robin Krahnen
892d2613c4 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.
2019-08-27 11:30:13 +02:00
Robin Krahnen
2d7249922a 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.
2019-08-27 11:30:13 +02:00
Robin Krahnen
6beae6f7b3 allow neos/flow ~5.3 2019-08-27 09:44:49 +02:00
9e4380c524 FEATURE: Adding ProgressViewHelper and some minor cleanups 2017-06-05 18:40:50 +02:00
8c71d9ac07 TASK: Apply migration Neos.Flow-20170127183102
Migrate bootstep names.

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.
2017-06-03 11:53:58 +02:00
8a4dcc589b TASK: Apply migration Neos.Flow-20170125103800
Migrate usages of the path [TYPO3][Flow][Security][Authentication] to
[Neos][Flow][Security][Authentication]

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.
2017-06-03 11:53:58 +02:00
7f5432e855 TASK: Apply migration Neos.Media-20161219094126
Migrate name for the media image size cache

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.
2017-06-03 11:53:58 +02:00
91e8899a37 TASK: Apply migration TYPO3.FluidAdaptor-20161130112935
Adjusts code to package renaming from "TYPO3.Fluid" to
"Neos.FluidAdaptor".
2017-06-03 11:53:57 +02:00
f6e8617fdf TASK: Apply migration Neos.SwiftMailer-20161130105617
Adjusts code to package renaming from "TYPO3.SwiftMailer" to
"Neos.SwiftMailer".

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.
2017-06-03 11:53:57 +02:00
caeb6e4b0c TASK: Apply migration Neos.Flow-20161125124112
Adjusts code to Neos\Flow\Utility\Unicode adjustment

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.
2017-06-03 11:53:57 +02:00
39e0a9e96a TASK: Apply migration Neos.Media-20161124233100
Adjusts code to package renaming from "TYPO3.Media" to "Neos.Media"

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.
2017-06-03 11:53:57 +02:00
ec7d8be5d4 TASK: Apply migration Neos.Imagine-20161124231742
Adjusts code to Imagine Renaming

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.
2017-06-03 11:53:57 +02:00
02d8a07173 TASK: Apply migration Neos.Eel-20161124230101
Adjusts code to Eel Renaming

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.
2017-06-03 11:53:57 +02:00
614a0fe2cc TASK: Apply migration Neos.Flow-20161124224015
Adjusts code to cache extraction

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.
2017-06-03 11:53:57 +02:00
e2ec22acf2 TASK: Apply migration Neos.Flow-20161124204701
Adjusts code to package renaming from "Neos.Flow.Utility.Files" to
"Neos.Utility.Files" and other extractions of the "Utility" packages.

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.
2017-06-03 11:53:57 +02:00
48e535fd36 TASK: Apply migration Neos.Flow-20161124204700
Adjusts code to package renaming from "TYPO3.Flow" to "Neos.Flow"
2017-06-03 11:53:57 +02:00
7af6a08fef TASK: Apply migration TYPO3.Flow-20161115140430
Adjust to the renaming of the Object namespace in Flow 4.0

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.
2017-06-03 11:53:57 +02:00
83115a5fef TASK: Apply migration TYPO3.Flow-20161115140400
Adjust to the renaming of the Resource namespace and class in Flow 4.0

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.
2017-06-03 11:53:57 +02:00
a423c660bb TASK: Apply migration TYPO3.Flow-20151113161300
Adjust "Settings.yaml" to new "requestPattern" and "firewall" syntax
(see FLOW-412)

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.
2017-06-03 11:53:57 +02:00
2b82c48b74 TASK: Apply migration Inwebs.Basket-201409170938
Changes path to export and changed Mail-Interface

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.
2017-06-03 11:53:57 +02:00
e11c20606f TASK: Import core migration log to composer.json
This commit imports the core migration log to the "extra" section of the
composer manifest.
2017-06-03 11:53:57 +02:00
a63fa594d2 TASK: Preparing migration to neos/flow 2017-06-03 11:50:20 +02:00
0f3b19ba49 TASK: Adding licence 2017-06-03 11:48:32 +02:00
f7af3e1024 TASK: PSR-4 2017-06-03 11:40:58 +02:00
9ea0c863dd TASK: PSR-2 and copyright notice 2017-06-03 11:39:59 +02:00
11 changed files with 343 additions and 146 deletions

View file

@ -1,15 +0,0 @@
<?php
namespace DigiComp\Menu\MenuService;
/* *
* This script belongs to the FLOW3 package "DigiComp.Controls". *
* *
* */
/**
* Interface for Menu-Configuration
*/
interface ServiceInterface {
public function getItems();
}

View file

@ -1,53 +0,0 @@
<?php
namespace DigiComp\Menu\MenuService;
/* *
* This script belongs to the FLOW3 package "DigiComp.Controls". *
* *
* */
use TYPO3\Flow\Annotations as Flow;
use TYPO3\Flow\Configuration\ConfigurationManager;
/**
* Class Menu
* @package DigiComp\Menu\Menu
*
* @Flow\Scope("singleton")
*/
class SettingsService implements ServiceInterface {
/**
* @var \TYPO3\Flow\Configuration\ConfigurationManager
*/
protected $configurationManager;
public function injectConfigurationManager(ConfigurationManager $configurationManager) {
$this->configurationManager = $configurationManager;
$this->menu = $this->configurationManager->getConfiguration('Menu');
}
/**
* @var array
*/
protected $menu;
protected $items = array();
/**
* @param string $forMenu
* @return array
*/
public function getItems($forMenu = NULL) {
if ($forMenu){
$items = &$this->menu[$forMenu];
}else {
$items = &$this->menu;
}
if ($items) {
uasort($items, function ($a, $b) {
return $a['sorting'] > $b['sorting'];
});
}
return $items;
}
}

View file

@ -1,25 +0,0 @@
<?php
/**
* @author skoetzing
* @date 07.07.14
*/
namespace DigiComp\Menu;
use TYPO3\Flow\Core\Bootstrap;
use TYPO3\Flow\Package\Package as BasePackage;
use TYPO3\Flow\Annotations as Flow;
use TYPO3\Flow\Configuration\ConfigurationManager;
class Package extends BasePackage{
public function boot(Bootstrap $bootstrap){
parent::boot($bootstrap);
$dispatcher = $bootstrap->getSignalSlotDispatcher();
$dispatcher->connect('TYPO3\Flow\Configuration\ConfigurationManager', 'configurationManagerReady',
function(ConfigurationManager $configurationManager){
$configurationManager->registerConfigurationType('Menu');
});
}
}

View file

@ -1,38 +0,0 @@
<?php
namespace DigiComp\Menu\ViewHelpers;
/* *
* This script belongs to the FLOW3 package "DigiComp.Controls". *
* *
* */
use TYPO3\Flow\Annotations as Flow;
/**
* Renders the sum of given collection and property name
*/
class MenuViewHelper extends \TYPO3\Fluid\Core\ViewHelper\AbstractViewHelper {
/**
* NOTE: This property has been introduced via code migration to ensure backwards-compatibility.
* @see AbstractViewHelper::isOutputEscapingEnabled()
* @var boolean
*/
protected $escapeOutput = FALSE;
/**
* @var \DigiComp\Menu\MenuService\ServiceInterface
* @Flow\Inject
*/
protected $menuService;
/**
* @param string $as
* @param string $forPath
* @return mixed
*/
public function render($as = 'menuItems', $forPath = NULL) {
$this->templateVariableContainer->add($as, $this->menuService->getItems($forPath));
return $this->renderChildren();
}
}
?>

View file

@ -0,0 +1,26 @@
<?php
namespace DigiComp\Menu\MenuService;
/*
* This file is part of the DigiComp.Menu package.
*
* (c) digital competence
*
* This package is Open Source Software. For the full copyright and license
* information, please view the LICENSE file which was distributed with this
* source code.
*/
/**
* Interface for Menu-Configuration
*/
interface ServiceInterface
{
/**
* @param string|null $forPath
*
* @return \Iterator
*/
public function getItems(string $forPath = null): \Iterator;
}

View file

@ -0,0 +1,50 @@
<?php
namespace DigiComp\Menu\MenuService;
/*
* This file is part of the DigiComp.Menu package.
*
* (c) digital competence
*
* This package is Open Source Software. For the full copyright and license
* information, please view the LICENSE file which was distributed with this
* source code.
*/
use Neos\Flow\Annotations as Flow;
/**
* @Flow\Scope("singleton")
*/
class SettingsService implements ServiceInterface
{
/**
* @Flow\InjectConfiguration(type="Menu")
* @var array
*/
protected array $menuConfiguration;
/**
* @var array
*/
protected array $items = [];
public function getItems(string $forPath = null): \Iterator
{
if ($forPath) {
$items = &$this->menuConfiguration[$forPath];
} else {
$items = &$this->menuConfiguration;
}
if ($items) {
\uasort(
$items,
static function ($a, $b) {
return $a['sorting'] > $b['sorting'];
}
);
}
return new \ArrayIterator($items);
}
}

37
Classes/Package.php Normal file
View file

@ -0,0 +1,37 @@
<?php
namespace DigiComp\Menu;
/*
* This file is part of the DigiComp.Menu package.
*
* (c) digital competence
*
* This package is Open Source Software. For the full copyright and license
* information, please view the LICENSE file which was distributed with this
* source code.
*/
use Neos\Flow\Configuration\ConfigurationManager;
use Neos\Flow\Core\Bootstrap;
use Neos\Flow\Package\Package as BasePackage;
/**
* Package base class of the DigiComp.Menu package.
*/
class Package extends BasePackage
{
public function boot(Bootstrap $bootstrap)
{
parent::boot($bootstrap);
$dispatcher = $bootstrap->getSignalSlotDispatcher();
$dispatcher->connect(
ConfigurationManager::class,
'configurationManagerReady',
function (ConfigurationManager $configurationManager) {
$configurationManager->registerConfigurationType('Menu');
}
);
}
}

View file

@ -0,0 +1,54 @@
<?php
namespace DigiComp\Menu\ViewHelpers;
/*
* This file is part of the DigiComp.Menu package.
*
* (c) digital competence
*
* This package is Open Source Software. For the full copyright and license
* information, please view the LICENSE file which was distributed with this
* 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
* TODO: Write example
*/
class ItemsViewHelper extends AbstractViewHelper
{
protected $escapeOutput = false;
/**
* @Flow\Inject
* @var ServiceInterface
*/
protected $menuService;
/**
* @throws Exception
*/
public function initializeArguments(): void
{
$this->registerArgument('for', 'string', 'path in Menu.yaml', false);
$this->registerArgument('as', 'string', 'Name in Frontend', false);
}
/**
* @return mixed
*/
public function render()
{
$this->templateVariableContainer->add(
$this->arguments['as'],
$this->menuService->getItems($this->arguments['for'])
);
return $this->renderChildren();
}
}

View file

@ -0,0 +1,80 @@
<?php
namespace DigiComp\Menu\ViewHelpers;
/*
* This file is part of the DigiComp.Menu package.
*
* (c) digital competence
*
* This package is Open Source Software. For the full copyright and license
* information, please view the LICENSE file which was distributed with this
* source code.
*/
use Neos\FluidAdaptor\Core\ViewHelper\AbstractViewHelper;
use Neos\FluidAdaptor\Core\ViewHelper\Exception;
/**
* Helps to get useful template variables for process menus
*/
class ProgressViewHelper extends AbstractViewHelper
{
protected $escapeOutput = false;
/**
* @throws Exception
*/
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, \EXTR_OVERWRITE);
//handling famous off by one
$activeStep -= $offset;
//make sure our array index is numeric
if (\is_iterable($links)) {
$links = \iterator_to_array($links);
}
$links = \array_values($links);
if (!$linkCount) {
$linkCount = \count($links);
}
foreach ($links as $i => &$link) {
$link['completed'] = $activeStep > $i;
$link['returnable'] = $returnable && $i < $activeStep;
}
$this->templateVariableContainer->add($linksAs, $links);
$this->templateVariableContainer->add($stepsAs, $linkCount);
$this->templateVariableContainer->add($activeStepAs, $activeStep + $offset);
$this->templateVariableContainer->add($activeStepLinkAs, $links[$activeStep]);
if (isset($links[$activeStep - 1])) {
$this->templateVariableContainer->add($backLinkAs, $links[$activeStep - 1]);
}
return $this->renderChildren();
}
}

19
License.txt Normal file
View file

@ -0,0 +1,19 @@
Copyright (c) 2021 Ferdinand Kuhl <f.kuhl@digital-competence.de>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
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.

View file

@ -1,21 +1,83 @@
{
"name":"digicomp/menu",
"type":"typo3-flow-package",
"description":"Menu",
"require":{
"typo3/flow":"~2.0|~3.0"
},
"require-dev":{
"phpunit/phpunit": "3.7.*"
},
"autoload":{
"psr-0":{
"DigiComp\\Menu":"Classes"
"name": "digicomp/menu",
"description": "Helps with the creation of simple fluid based menus",
"type": "neos-package",
"keywords": [
"Neos",
"Flow",
"menu"
],
"homepage": "https://git.digital-competence.de/Packages/DigiComp.Menu",
"license": "MIT",
"authors": [
{
"name": "Ferdinand Kuhl",
"email": "f.kuhl@digital-competence.de",
"homepage": "https://www.digital-competence.de",
"role": "Developer"
}
],
"require": {
"php": ">=7.4.0",
"neos/flow": "^6.3.21"
},
"require-dev": {
"mikey179/vfsstream": "^1.6.1",
"neos/buildessentials": "^7.0.0",
"phpunit/phpunit": "~8.5",
"vimeo/psalm": "~4.22.0"
},
"autoload": {
"psr-4": {
"DigiComp\\Menu\\": "Classes/"
}
},
"config": {
"sort-packages": true,
"platform-check": true
},
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
"dev-develop": "3.0.x-dev",
"dev-version/2.x-dev": "2.0.x-dev"
},
"neos": {
"package-key": "DigiComp.Menu"
},
"applied-flow-migrations": [
"TYPO3.Fluid-20150214130800",
"TYPO3.Fluid-20141121091700",
"TYPO3.Flow-20141113121400",
"TYPO3.Fluid-20141113120800",
"TYPO3.Flow-201405111147",
"TYPO3.Flow-201310031523",
"TYPO3.Flow-201212051340",
"TYPO3.Flow-201211151101",
"TYPO3.Flow-201209251426",
"TYPO3.FLOW3-201209201112",
"TYPO3.FLOW3-201206271128",
"TYPO3.FLOW3-201205292145",
"TYPO3.Fluid-201205031303",
"TYPO3.FLOW3-201201261636",
"DigiComp.Excel-201308011951",
"Inwebs.Basket-201409170938",
"TYPO3.Flow-20151113161300",
"TYPO3.Flow-20161115140400",
"TYPO3.Flow-20161115140430",
"Neos.Flow-20161124204700",
"Neos.Flow-20161124204701",
"Neos.Flow-20161124224015",
"Neos.Eel-20161124230101",
"Neos.Imagine-20161124231742",
"Neos.Media-20161124233100",
"Neos.Flow-20161125124112",
"Neos.SwiftMailer-20161130105617",
"TYPO3.FluidAdaptor-20161130112935",
"Neos.Media-20161219094126",
"Neos.Flow-20170125103800",
"Neos.Flow-20170127183102",
"DigiComp.SettingValidator-20170603120900",
"Neos.Flow-20180415105700"
]
}
}
}