Hi everyone!
I’m trying to show a button only if a subpage exist and I thought that $pages->has($page) will work for me, so I followed the documentation but is not working as I expected.
I’ve printed $page->children() and I’ve found that the collection is made of the subpages paths. Is this correct?
This is either a bug or the example is wrong. $pages->has() seems to work only on the pages level, i.e. pages of the first level, not on the children level. Need to correct this in the docs.
No, no, no , as I said, it only works on the $pages collection, $pages includes all pages of the first level in content, in the starterkit that would be “about”, “projects” etc. The correct code would be:
$pages->has('about');
But that won’t help you any if you want to check for a child page.
Yes I thought it too, but this is not really dynamic to re use it on the pages.
Should I pass it the parent page as variable? and concatenate the strings?
Thanks.