Articles
Articles copied to clipboard
Articles affecting menuindex enumeration
After installing Articles, I have experienced issues on several sites with the menuindex value being set incorrectly. The menuindex of certain resources somehow ends up being a duplicate of the menuindex in another resource. This causes one of the affected resources to be invisible from the tree.
I can cause it to reappear by manually editing the menuindex value in the DB but that's not a great solution, of course. And the problem reappears once I begin rearranging the items in the tree again.
It's difficult to isolate the steps necessary to reproduce this initially, but once it manifests, it's fairly persistent.
Provided consistent steps to reproduce this can be debugged further
Two resources with the same menu index should not prevent one of them from appearing in the tree
I can confirm this issue on every site have that runs articles. This appears to occur when the ID of the articles container is lower than the ID of a document that you attempt to move "above" the articles container in the tree.
Manually editing menuindex values in the database does not appear to have any effect on resolving the issue. It basically becomes impossible to move the articles container, moving it appears to work fine, but then if you refresh the tree view it's actually hidden
Thanks for chiming in, Jay. I am really surprised to hear so few people reporting this issue as it crops up every time I implement Articles. Yet I can't reliably identify the steps to reproduce it.
This issue has been mentioned on MODX Community. There might be relevant details there:
https://community.modx.com/t/one-resource-and-children-missing-from-resource-tree/4868/15
The problem seems to be, that MODX adds objects differently to a collection depending on if they are lazy or not.
https://github.com/modxcms/revolution/blob/d8202a381dfe8a3c8ab9d8699198d8fe4d87ff45/core/model/modx/modaccessibleobject.class.php#L69-L73
If there is a mixture between lazy and non-lazy objects, values may get overwritten.
https://github.com/modxcms/Articles/blob/380b387e2077961e77c09350b10616fc085747ad/core/components/articles/model/articles/articlescontainer.class.php#L222-L229
There is a more detailed explanation in the MODX forum: https://community.modx.com/t/one-resource-and-children-missing-from-resource-tree/4868/11