Bug #67945
closedCondition ViewHelper not evaluated correctly
0%
Description
Simple Setup:
This is my fluid template:
<p:frontPage> <f:then> <div class="header-slideshow"> <f:cObject typoscriptObjectPath="lib.renderContent" data="{uid:55}"/> </div> </f:then> <f:else> FOO </f:else> </p:frontPage>
The viewhelper is very simple and makes basically this:
return ((integer) $GLOBALS['TSFE']->page['is_siteroot'] === 1) ? $this->renderThenChild() : $this->renderElseChild();
On first page load the viewhelper is called 2 times (?) I can see that because i put some debug outputs there.
On the secod load the viewhelper returns the Else child. But if i debug the condition
var_dump((integer) $GLOBALS['TSFE']->page['is_siteroot'] === 1);
It allways says TRUE
Anyway
"FOO" is printed from the second run onwards.
HEAD is @ 89139e8
Updated by Philipp Wrann over 9 years ago
I think the problem might is the fact, that my viewhelper does not need a condition argument, but
AbstractConditionViewHelper::renderStatic calls static::evaluateCondition and returns FALSE if $arguments['condition'] is not set.
I would suggest to implement the CompilableInterface only in the concrete Fluid\IfViewHelper, not in the AbstractConditionViewHelper, this might break many applications.
I overruled the static renderStatic method in my viewhelper to fix the issue in my case.
Updated by Claus Due about 9 years ago
This is the new inner API of AbstractConditionViewHelper; implemented to make all of them compilable. It certainly has broken a lot of applications - see for example the VHS extension which required a massive effort to make all condition ViewHelpers compatible with both the old and new API.
This issue can be closed - it's "by design" and "won't fix" :)