0
votes

So I need to use the "isChildPage" viewhelper in fluid. However it does not work, and if I run

<f:debug>{item}</f:debug>

For the item/page in question I get nothing for childpage. Its sibling viewhelper "hasSubPage" however works fine, and both classes are located in the same Page folder in the vhs extension.

So I am at a loss.

My use of the code:

<v:menu pageUid="{parent}" entryLevel="2" class="sidebar-nav" includeSpacers="1">
            <f:for each="{menu}" as="item">
                   <a href="{item.link}" class=" {f:if(condition: item.isChildPage, then: 'hidden', else:'nope')}">
1
isChildPage has a different meaning than hasSubPage. each page which is not root (uid = 0) should be isChildpage, - Bernd Wilke πφ
Yes, ofcourse. Thats why I need it. But it does not work for any page, even tho its level 4 between 5 and 3, or something else. Its not in the array that debug gives either - NicklasN

1 Answers

0
votes

There isn't an attribute for 'item' called 'isChildPage' in newer vhs versions (https://fluidtypo3.org/viewhelpers/vhs/master/)

Which output do you want to receive?


Use

{f:if(condition: item.pid > 0, then: 'hidden', else:'nope')}

or

{f:if(condition: item.pid == 0, then: 'nope', else:'hidden')}

item.pid is the UID of the parent page.

This will set class 'hidden' to all links except root page link.