diff --git a/Classes/DigiComp/Menu/MenuService/ServiceInterface.php b/Classes/DigiComp/Menu/MenuService/ServiceInterface.php new file mode 100644 index 0000000..6873d98 --- /dev/null +++ b/Classes/DigiComp/Menu/MenuService/ServiceInterface.php @@ -0,0 +1,15 @@ +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; + } + + +} \ No newline at end of file diff --git a/Classes/DigiComp/Menu/Package.php b/Classes/DigiComp/Menu/Package.php new file mode 100644 index 0000000..a252707 --- /dev/null +++ b/Classes/DigiComp/Menu/Package.php @@ -0,0 +1,25 @@ +getSignalSlotDispatcher(); + $dispatcher->connect('TYPO3\Flow\Configuration\ConfigurationManager', 'configurationManagerReady', + function(ConfigurationManager $configurationManager){ + $configurationManager->registerConfigurationType('Menu'); + }); + } + +} \ No newline at end of file diff --git a/Classes/DigiComp/Menu/ViewHelpers/MenuViewHelper.php b/Classes/DigiComp/Menu/ViewHelpers/MenuViewHelper.php new file mode 100644 index 0000000..2656162 --- /dev/null +++ b/Classes/DigiComp/Menu/ViewHelpers/MenuViewHelper.php @@ -0,0 +1,30 @@ +templateVariableContainer->add($as, $this->menuService->getItems($forPath)); + return $this->renderChildren(); + } +} + +?> \ No newline at end of file diff --git a/Configuration/Objects.yaml b/Configuration/Objects.yaml new file mode 100644 index 0000000..53e3ed5 --- /dev/null +++ b/Configuration/Objects.yaml @@ -0,0 +1,2 @@ +DigiComp\Controls\Menu\ServiceInterface: + className: DigiComp\Controls\Menu\SettingsService \ No newline at end of file