Wayfinder not setting lastClass

Hello,

I have a problem with a wayfinder call not setting lastClass, when a category has only one child.

The wayfinder call is:

[[Wayfinder?&debug=0&startId=0&level=0&hideSubMenus=0&textOfLinks=pagetitle&parentRowTpl=drop12_parentRow_PHx&parentRowHereTpl=drop12_parentRowHere_PHx&outerTpl=drop12_outer&innerTpl=drop12_inner&rowTpl=drop12_row&innerRowTpl=drop12_innerRow&outerClass=menu2&innerClass=sub&parentClass=fly&firstClass=subtop&lastClass=subbot&hereClass=here&selfClass=self&levelClass=level]]

The chunk “drop12_innerRow” consists of:

  • [[+wf.linktext]][[+wf.wrapper]]
  • The resulting html is:

    • Coaching

    The html of a menu part with more with one childs does set subbot in the last child element:

    • Allgemeine Informationen
    • Tiefenpsychologisch fundiert
    • Analytisch

    Any ideas how to fix this?

    Kind regards
    Andre

    I think this is the normal behavior.

    In the code, there is an explicit check to only set “last” if there is more than 1 subitem:

    I also tested pdoMenu, and it works the same.

    Hey,

    thanks for your quick answer. It may be normal behaviour, but I think that’s kind of error by design. A last element should get lastClass set, regardless if there are other elements - the first element can be the last element.

    Have you any recommandations for me, how to deal with this? I could try to change the code, I did some php programming years ago, but I would run in problems with every update.

    Should I try to contact the developer, so he could change it, or maybe provide a config option in the snippet’s call like oneChildOnlySetLastClass=true/false?

    Kind regards
    Andre

    Well the code has been like this for years. Changing it now could create unexpected results with existing code.

    Do you really need this class set?
    Maybe you can adapt your CSS do deal with such cases → for example by using the :only-child pseudo class.

    This extras hasn’t been updated in a long time. I suspect nobody will touch the code until there’s a compelling reason (like a fatal error).

    Hm, that looks like something, I’ll try this and come back, thanks alot!

    This worked, thanks alot!