DigiComp.Menu/Classes/ViewHelpers/ItemsViewHelper.php

43 lines
965 B
PHP
Raw Permalink Normal View History

<?php
namespace DigiComp\Menu\ViewHelpers;
2017-06-03 11:39:59 +02:00
/*
* 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;
2017-06-03 11:39:59 +02:00
/**
2017-06-03 11:39:59 +02:00
* Just adds the return of MenuService
* TODO: Write example
*/
class ItemsViewHelper extends AbstractViewHelper
2017-06-03 11:39:59 +02:00
{
2017-06-03 11:39:59 +02:00
protected $escapeOutput = false;
/**
* @var \DigiComp\Menu\MenuService\ServiceInterface
* @Flow\Inject
*/
protected $menuService;
2017-06-03 11:39:59 +02:00
/**
* @param string $as
* @param string $for
2017-06-03 11:39:59 +02:00
* @return string
*/
public function render($as = 'items', $for = null)
2017-06-03 11:39:59 +02:00
{
$this->templateVariableContainer->add($as, $this->menuService->getItems($for));
return $this->renderChildren();
}
}