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.]
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.
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.
Did this turn out to be a temporary or permanent solution?
-
☆ 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.
You could also set the isfolder field of the Articles container resource to "not a container" with this simple snippet:
/* 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.]
Can Wayfinder apply a class that specifies the classKey of the resource? You could then do .modArticleContainer.container as a CSS selector
jpdevries
Thanks Bob but I couldn't get this to work - all I got was the output:
Articles Container not found