vhs icon indicating copy to clipboard operation
vhs copied to clipboard

BUG: sort viewhelper "subject"/"as handling

Open helsner opened this issue 4 years ago • 1 comments

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.

helsner avatar Mar 29 '21 08:03 helsner

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!

NamelessCoder avatar Mar 29 '21 14:03 NamelessCoder