We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36932
    • 39 Posts
    Hello everyone,

    I got a question about wayfinder that might turn out into a suggestion.

    I want wayfinder to only list ids, that are containers. After doing some research, I'm pretty sure, that there isn't an option to do that built in. Another possibilty (and handy function for everyone, I suppose) would be to list only IDs of one/several specified templates. I don't see a function for that, too...?

    The specific case I'm currently working on looks like the following:
    I got one main menu and there are links on two levels. In one branch of the menu, the parent is a container and it's children are containers, too. All of them should be visible in the menu. In another branch of the same menu, the children aren't containers and shouldn't be visible in the menu. I don't think, that this is a very special case.

    Currently, I'm using CSS selectors with display:none; as a workaround, but I would really like to get rid of that unneccesary extra markup. I would be glad, if anyone might point me into the right direction how to archieve this. Thank you very much in advance for any remarks on this.

    By the way: is there a public repository for the development of wayfinder? I'm considering to write some modifications to solve my problem, but I would like to contribute them to the project afterwards and didn't find a clue on where to do this.

    With kind regards,
    Marc
      • 22303 MODX Staff
      • 10,725 Posts
      See the public repository at https://github.com/splittingred/Wayfinder
        • 36932
        • 39 Posts
        Thanks a lot for your quick reply!
        I'm going to dive into that code when I have some time for it in the next days.

        I assume there's no easy way to archieve what I described in my initial post, without altering Wayfinder itself?
          • 36932
          • 39 Posts
          Ok, I checked the manual one more time and came up with a pretty easy (and also obvious) solution, to not show the submenu of certain ids.

          I just use this code in a chunk and refer to it as &activeParentRowTpl in my wayfinder call
          [[If?
             &subject=`[[+id]]`
             &operator=`EQ`
             &operand=`5`
             &then=`<li[[+wf.id]][[+wf.classes]] rel="archive"><a href="[[+wf.link]]" title="[[+wf.title]]" [[+wf.attributes]]>[[+wf.linktext]]</a></li>`
             &else=`<li[[+wf.id]][[+wf.classes]] rel="normal"><a href="[[+wf.link]]" title="[[+wf.title]]" [[+wf.attributes]]>[[+wf.linktext]]</a>[[+wf.wrapper]]</li>`
          ]]
          


          Essentially, I just leave out the childrens of id 5 by ommitting [[+wf.wrapper]].
          It should be no problem to use something similiar to leave out all children, that aren't containers. I have no time to check this now, but I'll post a solution for it here as soon as I figured it out.

          With kind regards,
          Marc