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

[BUGFIX] Adding NULL as option in Extends type select list on editType form

A type doesn't need to extend a type.
parent 841c34cd
No related branches found
No related tags found
No related merge requests found
......@@ -78,6 +78,9 @@ class TsrefController extends \TYPO3\Flow\Mvc\Controller\ActionController {
public function submitTypeAction(
Attribute $theType, $editForm, $typo3Version = TsrefRestService::TYPO3_CURRENT_VERSION_LABEL
) {
if ($theType->getParent() === -1) {
$theType->setParent(NULL);
}
if ($editForm) {
$result = $this->tsrefRestService->editAttribute($theType);
} else {
......@@ -107,10 +110,12 @@ class TsrefController extends \TYPO3\Flow\Mvc\Controller\ActionController {
$this->prepareTypeMenu($typeId, $typo3Version);
$typo3Groups = $this->tsrefRestService->getAllTypo3Groups();
$selectMenuTypes = $this->tsrefRestService->getTypesWithNull($typo3Version);
$this->view->assign('typo3Groups', $typo3Groups);
$this->view->assign('theType', $theType);
$this->view->assign('editForm', ($typeId !== NULL));
$this->view->assign('selectMenuTypes', $selectMenuTypes);
}
/**
......
......@@ -3,6 +3,7 @@
namespace SGalinski\TypoScriptReferenceFrontend\Service;
use SGalinski\TypoScriptReferenceFrontend\Domain\Model\Attribute;
use SGalinski\TypoScriptReferenceFrontend\Utilities\Conversion;
use TYPO3\Flow\Annotations as Flow;
/**
......@@ -290,4 +291,16 @@ class TsrefRestService {
'all' => 'All',
];
}
/**
* Gets en array of types for given TYPO3 version. The types are fetched with name and id only.
*
* @param string $typo3Version
* @return array
*/
public function getTypesWithNull($typo3Version) {
$typesAssociative =Conversion::toAssociativeIdNamesArray($this->getTypes(TRUE, $typo3Version));
$typesAssociative = [-1 => 'No type (NULL)'] + $typesAssociative;
return $typesAssociative;
}
}
\ No newline at end of file
......@@ -33,7 +33,7 @@
<label for="extends" class="col-sm-2 control-label">Extends</label>
<div class="col-sm-10">
<f:form.select property="parent" options="{types}" id="extends" class="form-control" />
<f:form.select property="parent" options="{selectMenuTypes}" id="extends" class="form-control" />
</div>
</div>
......
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