Method on system object #nav to get boolean or number of visible children

Most webdesigner use different styles for navigation points with and without children. In portals you can often find a navigation with toggle function to expand or hide sub-navigation points. In the function "Navigation" it would be nice to have a method on the #nav object that returns if a navigation point has in navigation and/or sitemap shown children. The result could be a boolean or the number of visible children. This method could replace the call of complex scripts inside the function "Navigation".

5 Comments
witt
I'm new here

There is a method available => #nav.hasSubFolders() that covers your use case.

C_Klingbeil
I'm new here

I've already tried this, but the result are all visible and invisible subfolders. To implementate a toggle function for navigation points that are not shown in the navigation is not useful 😉

witt
I'm new here

Ok, but then please create a ticket in our helpdesk system. It seems to me that this is a bug. I expect that only visible folders are shown. Which version are you using?

C_Klingbeil
I'm new here

I don't think that this behaviour is a bug. I'd rather say, it's the expected behaviour for "hasSubFolders" because it returns, if a folder HAS subfolders. The method isn't called like "hasVisibleSubFolders" or something else. And if the method "hasSubFolders" would return only visible folders, which method on a navigation point (via FolderLangSpec) would be the ruler: isVisible oder getShowInSitemap or both?

To the FS versions: I tested it in 4.1 and 4.2 and both results were equal: hasSubFolders was true although all subfolders were invisible in navigation and sitemap.

matthiasforberg
Occasional Collector

I had the same request some time ago and I also proposed to invent a method "hasVisibleSubFolders", that returns only subs which are included in the navigation. Unnecessary to mention, that this should work language-dependent.