We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22827
    • 129 Posts
    An Articles container has the container (isfolder) setting enabled, as it is a container.

    Makes perfect sense.

    All articles have "hide in menus" enabled, also makes perfect sense.

    However, if you use Wayfinder to construct a menu that has an Articles container as one of the elements, Wayfinder will add the styles for menu items with child items - it does this based on the container status. So the Articles menu entry appears to have children when it doesn't have any that are displayed.

    There doesn't seem to be a way to switch off the container setting for an articles container, and even if there was, adding a new article to the container would presumably turn it back on again like it does for normal documents.

    Ideally wayfinder would only use the template for menu items with children when there are actual children to be displayed, not just when the container setting is on.

    Can anyone suggest a workaround? [ed. note: paulkoan last edited this post 13 years, 1 month ago.]
      • 3749
      • 24,544 Posts
      In Revolution, the isfolder resource field determines whether the resource is a "container" and is independent of whether the resource has children. So, if you change it in the database (in PhpMyAdmin), it won't get reset when you add children. I'm not sure if that would solve your problem but Wayfinder definitely checks the isfolder field, so it might.

      More info here: http://bobsguides.com/blog.html/2013/04/27/understanding-isfolder-and-haschildren()/

      BTW, the place to change isfolder is in the modx_site_content table.
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 22827
        • 129 Posts
        Thanks Bob,

        This is exactly what I did as a workaround, but I was fairly sure that modx turned on the isfolder switch each time you added a document under the parent.

        So I considered it a temporary solution. If it sticks, then it is what I need.

        Exposing the container setting in the Articles container is probably worthwhile, as this would be a common use-case I would have thought.
          • 3749
          • 24,544 Posts
          It's worth a feature request: http://bugs.modx.com/projects/articles wink
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 22827
            • 129 Posts
            Heh, done.
              • 36582
              • 463 Posts
              Did this turn out to be a temporary or permanent solution?
                Web site design in Nottingham UK by Chris Fickling http://www.chrisficklingdesign.co.uk
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                I believe that the parentRowTpl and the categoryFoldersTpl both are only applied to a parent resource that has its children displayed, so you should be able manipulate one or another of those tpls to get the menu layout that you want.
                  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
                  • 3749
                  • 24,544 Posts
                  You could also set the isfolder field of the Articles container resource to "not a container" with this simple snippet:


                  [[!ClearContainerField]]


                  /* ClearContainerField snippet */
                  $containerId = 12; /* Set this to the ID of your Articles container resource */
                  $doc = $modx->getObject('modResource', $containerId);
                  if ($doc) {
                     $doc->set('isfolder', 0);
                     $doc->save();
                     $output = 'Cleared Articles container isfolder field';
                  } else {
                     $output = 'Articles Container not found';
                  }
                  
                  return $output;


                  Just create a snippet called ClearContainerField with the code above, put the tag at the top on a page and view the page. [ed. note: BobRay last edited this post 12 years, 11 months ago.]
                    Did I help you? Buy me a beer
                    Get my Book: MODX:The Official Guide
                    MODX info for everyone: http://bobsguides.com/modx.html
                    My MODX Extras
                    Bob's Guides is now hosted at A2 MODX Hosting
                    • 38290
                    • 712 Posts
                    Can Wayfinder apply a class that specifies the classKey of the resource? You could then do .modArticleContainer.container as a CSS selector
                      jpdevries
                      • 36582
                      • 463 Posts
                      Thanks Bob but I couldn't get this to work - all I got was the output:

                      Articles Container not found
                        Web site design in Nottingham UK by Chris Fickling http://www.chrisficklingdesign.co.uk