49 lines
1.2 KiB
PHP
49 lines
1.2 KiB
PHP
<?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\Flow\Annotations as Flow;
|
|
use Neos\FluidAdaptor\Core\ViewHelper\AbstractViewHelper;
|
|
|
|
/**
|
|
* Just adds the return of MenuService
|
|
* TODO: Write example
|
|
*/
|
|
class ItemsViewHelper extends AbstractViewHelper
|
|
{
|
|
protected $escapeOutput = false;
|
|
|
|
/**
|
|
* @var \DigiComp\Menu\MenuService\ServiceInterface
|
|
* @Flow\Inject
|
|
*/
|
|
protected $menuService;
|
|
|
|
public function initializeArguments(): void
|
|
{
|
|
$this->registerArgument('for', 'string', 'path in Menu.yaml', false);
|
|
$this->registerArgument('as', 'string', 'Name in Frontend', false);
|
|
}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function render(): string
|
|
{
|
|
$this->templateVariableContainer->add(
|
|
$this->arguments['as'],
|
|
$this->menuService->getItems($this->arguments['for'])
|
|
);
|
|
return $this->renderChildren();
|
|
}
|
|
}
|