I'm using Glass 5.4.18 with Sitecore 9.0.2. I have a base template for my site that has language fallback turned on by default, but for a few items the client wants to disable language fallback so the item does not appear in certain languages.
I've gone into the individual item in a navigation tree and unchecked Enable Language Fallback, and I've tried this both with and without Enforce Version Presence checked on. But when I retrieve the item in my controller as follows:
IGlassBase testGlass = _mvcContext.SitecoreService.GetItem<IGlassBase>(new Guid("{5D70191B-546B-4902-B764-175F2C4FE6DB}"));
The "testGlass" variable is not null like I'd expect it to be. I get the item details back, but if I check the actual item (either through a Glass property marked with the SitecoreItem
attribute, or using the Sitecore API directly) I see the Versions.Count
is 0 as I'd expect.
A lot of the prior answers on this topic appear to be from Glass 4 or when language fallback was first introduced, and mention using a VersionCountDisabler. I didn't think any extra wiring was necessary at this stage, but my direct query and looping past them item in a SitecoreChildren iteration yield the item to display in my navigation tree incorrectly.
I feel like I'm missing a setting, but I can't find what it might be, if there's a configuration or script I need to add in. I could do a .Where
and look for Versions.Count > 0
but that seems excessive.