<?php namespace SGalinski\TypoScriptReferenceFrontend\Controller; /* * * This script belongs to the TYPO3 Flow package "SGalinski.TypoScriptReferenceFrontend".* * * * */ use SGalinski\TypoScriptReferenceFrontend\Service\TsrefRestService; use TYPO3\Flow\Annotations as Flow; class TsrefController extends \TYPO3\Flow\Mvc\Controller\ActionController { /** * @var TsrefRestService */ protected $tsrefRestService; /** * The constructor is used for dependency injection. * * @param TsrefRestService $service */ public function __construct(TsrefRestService $service) { $this->tsrefRestService = $service; } /** * The action which fetches the data for typoScript reference page, and displays the page. * * @param int $typeId * @return void */ public function indexAction($typeId = NULL) { if ($typeId !== NULL) { $selectedType = $this->tsrefRestService->getAttributeById($typeId); $properties = $this->tsrefRestService->getPropertiesByParentId($typeId); $this->view->assign('properties', $properties); $this->view->assign('selectedType', $selectedType); if (isset($selectedType->parent_id)) { $superType = $this->tsrefRestService->getAttributeById($selectedType->parent_id); $this->view->assign('superType', $superType); } } $types = $this->tsrefRestService->getTypes(); $this->view->assign('types', $types); } }