FluidTYPO3 / vhs

TYPO3 extension VHS: Fluid ViewHelpers
https://fluidtypo3.org
Other
190 stars 229 forks source link

BUG: sort viewhelper "subject"/"as handling #1713

Closed helsner closed 12 months ago

helsner commented 3 years ago

I got the issue that the sortviewhelper returns null when using the "subject" argument instead of the children. $subject = static::arrayFromArrayOrTraversableOrCSVStatic(!empty($arguments['as']) ? $arguments['subject'] : $renderChildrenClosure()); in https://github.com/FluidTYPO3/vhs/blob/development/Classes/ViewHelpers/Iterator/SortViewHelper.php#L112 returns the children closure even if subject is set due to the necesseary "as". But adding "as" then fails later on while processing the name of the variable when calling return static::renderChildrenWithVariableOrReturnInputStatic(... at the end of the function

The current workaround is to only use the children closure handling.

NamelessCoder commented 3 years ago

Very true, this looks like a leftover from a time when the render children closure did not take the "content argument" into account. I would appreciate a pull request that changes the ternary condition to simply calling $renderChildrenClosure() to get the input argument for the array resolving function!