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

    I have a situation where several parent resources which have 30 or more child resources that I do NOT want to be included in the main navigation. In addition, I really can't "Hide From Menus" all these children as they are used by getResources in several other places AND I'm using Hide/Un-hide to turn them off and on in some cases anyway.

    What I'd really like is something like: &ignoreChildren=`256,449,895`
    Which would tell Wayfinder or getResources to get the children except in where it's told it ignore them.

    Does anyone have a suggestion on how to do this with either Wayfinder or getResources?

    If I wanted to add this to Wayfinder, would the right place be to modify the function getChildIds in the wayfinder class?

    Thanks in advance


    Modx = 2.2.8-pl
    TinyMCE = 4.3.3-pl
    Gallery = 1.5.2-pl
      • Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 10525
        • 247 Posts
        Hi,

        I am trying to do exactly as @curmudgeon61 has just described. I'd already discovered &where in the Wayfinder Ganeral Params list, but the only info there is:

        &where - JSON style filtering option. For example when trying to hide blog or news from the Articles addon: &where=`[{"class_key:!=": "Article"}]`

        There is no link or reference to anywhere that gives further information on JSON style filtering option as applied to wayfinder. Can't find anything via google. Is there a list of JSON style modx param names (ege parentid/parent_id etc) and operators/booleans anywhere?

        Thanks.
        • Any site_resources field should do the job. For example
          &where=`[{"parent:NOT IN": array(256,449,895)}]`


          https://rtfm.modx.com/xpdo/2.x/class-reference/xpdoquery/xpdoquery.where
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 10525
            • 247 Posts
            Thanks Susan. It looks good, but for some reason doesn't work. If a child of one of the listed parents isn't hidden from menus, it still shows.

            I've added a suggestion in GitHub for &where links and examples to be included in the Wayfinder page. [ed. note: Gav last edited this post 8 years, 7 months ago.]
            • I know that's the syntax for xPDO WHERE clauses, did you try this with just a comma-separated list instead of an array?
                Studying MODX in the desert - http://sottwell.com
                Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                Join the Slack Community - http://modx.org
                • 10525
                • 247 Posts
                So far I've tried the following, without success:

                &where=`[{"parent:NOT IN": array(5,61)}]` - doesn't work: child resources show
                &where=`[{"parent:NOT IN": "array(5,61)"}]` - breaks Wayfinder: no menu at all
                &where=`[{"parent:NOT IN": array("5","61")}]` - doesn't work: child resources show
                &where=`[{"parent:NOT IN": "5,61"}]` - breaks Wayfinder: no menu at all
                &where=`[{"parent:NOT IN": "(5,61)"}]` - breaks Wayfinder: no menu at all
                &where=`[{"parent:NOT IN": (5,61)}]` - doesn't work: child resources show
                &where=`[{"parent:=": 5}]` - breaks Wayfinder: no menu at all
                &where=`[{"parentId:=": "5"}]` - breaks Wayfinder: no menu at all
                &where=`[{"parentid:=": "5"}]` - breaks Wayfinder: no menu at all
                &where=`[{"parent_id:=": "5"}]` - breaks Wayfinder: no menu at all
                &where=`[{"parent": "5"}]` - breaks Wayfinder: no menu at all
                &where=`[{"parent:NOT IN" => array(5,61)}]` - doesn't work: child resources show
                &where=`[{"parent:!=' => 5}]` - doesn't work: child resources show

                I look forward to some examples in the Wayfinder page, otherwise this &where business is unusable for people who are not familiar with this "JSON-like" filtering smiley

                Anybody know how this question can be answered?
                  • 10525
                  • 247 Posts
                  OK, I finally got my answer and got this working:
                  &where=`[{"parent:NOT IN": [1,3]}]`

                  Thanks to Steffan http://forums.modx.com/thread/98225/how-to-use-wayfinder-with-where-to-filter-ignore-children-of-specific-resources#dis-post-531149.