Skip to content
Snippets Groups Projects
Commit cd9644b4 authored by damjan's avatar damjan
Browse files

[TASK] Refactoring - extracting function: prepareTypeMenu

parent 675081c1
No related branches found
No related tags found
No related merge requests found
......@@ -39,7 +39,6 @@ class TsrefController extends \TYPO3\Flow\Mvc\Controller\ActionController {
$properties = $this->tsrefRestService->getPropertiesByParentId($typeId);
$this->view->assign('properties', $properties);
$this->view->assign('selectedType', $selectedType);
$this->view->assign('selectedTypeId', $typeId);
// If the type extends a type (superType), the superType name is being fetched among other fields
if (isset($selectedType->parent_id)) {
......@@ -48,8 +47,7 @@ class TsrefController extends \TYPO3\Flow\Mvc\Controller\ActionController {
}
}
$types = Conversion::toAssociativeIdNamesArray($this->tsrefRestService->getTypes());
$this->view->assign('types', $types);
$this->prepareTypeMenu($typeId);
}
/**
......@@ -81,15 +79,13 @@ class TsrefController extends \TYPO3\Flow\Mvc\Controller\ActionController {
$selectedTypeAsStdClass = $this->tsrefRestService->getAttributeById($theTypeId);
$theType->initialiseAttribute($selectedTypeAsStdClass);
$this->view->assign('selectedType', $selectedTypeAsStdClass);
$this->view->assign('selectedTypeId', $theTypeId);
}
$types = $this->tsrefRestService->getTypes();
$associativeTypes = Conversion::toAssociativeIdNamesArray($types);
$this->prepareTypeMenu($theTypeId);
$typo3Groups = $this->tsrefRestService->getAllTypo3Groups();
$this->view->assign('typo3Groups', $typo3Groups);
$this->view->assign('types', $associativeTypes);
$this->view->assign('theType', $theType);
$this->view->assign('editForm', ($theTypeId !== NULL));
}
......@@ -119,4 +115,16 @@ class TsrefController extends \TYPO3\Flow\Mvc\Controller\ActionController {
// $this->view->assign('theType', $theProperty);
// $this->view->assign('editForm', ($thePropertyId !== NULL));
}
/**
* Sets view variables needed for type menu.
*
* @param $theTypeId
*/
protected function prepareTypeMenu($theTypeId) {
$types = $this->tsrefRestService->getTypes();
$associativeTypes = Conversion::toAssociativeIdNamesArray($types);
$this->view->assign('types', $associativeTypes);
$this->view->assign('selectedTypeId', $theTypeId);
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment