Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
namespace NL\NlMenubuilder\ViewHelpers\Menu\Controller;
use NL\NlMenubuilder\Domain\Model\Menu;
use NL\NlMenubuilder\Domain\Repository\MenuRepository;
use TYPO3\CMS\Fluid\Core\Widget\AbstractWidgetController;
class RenderController extends AbstractWidgetController
{
/**
* @var MenuRepository
*/
protected $menuRepository;
/**
* Inject menu repository
*
* @param MenuRepository $repository
*/
public function injectMenuRepository(MenuRepository $repository)
{
$this->menuRepository = $repository;
}
/**
* @return string
*/
public function indexAction(): string
{
/** @var Menu $menu */
$menu = $this->menuRepository->findByIdentifier($this->widgetConfiguration['uid']);
$this->view->assign('menu', $menu);
return $this->view->render($menu ? $menu->getTemplate() : Menu::DEFAULT_TEMPLATE);
}
}