Issue Bug Closed

#86743Inline "then"/"else" not working for IfHasRoleViewHelper

Mathias Brodala 10/25/18, 11:08 updated 05/07/19, 12:15

Description

Since TYPO3v8 using the inline then and else arguments on the IfHasRoleViewHelper does not work anymore.

Thus {f:security.ifHasRole(role: 10, then: 'YES', else: 'NO')} leads to an error:

> Undeclared arguments passed to ViewHelper TYPO3\CMS\Fluid\ViewHelpers\Security\IfHasRoleViewHelper: then, else. Valid arguments are: role

This happens because IfHasRoleViewHelper::initializeArguments() does not call the same method of TYPO3Fluid\Fluid\Core\ViewHelper\AbstractConditionViewHelper.

In TYPO3v7 this was avoided because TYPO3\CMS\Fluid\Core\ViewHelper\AbstractConditionViewHelper did register these arguments in its constructor. Thus this is a regression.

Reviews 2