I have an SXA site. It has language fallback enabled on the site node. Page and component datasource templates' standard values have had both their item level and field level fallback enabled for non-shared fields.
I have the following code:
IMvcContext mvcContext = new MvcContext(); var bannerItem = mvcContext.GetDataSourceItem<FullImageCrossLinkBannerItem>();
This code returns the given model class with all fields mapped properly when I browse to the default language version I have set up (English). However, when I browse to a different language version that's empty or doesn't exist, the shared fields come back as null; even though they're values are set. The other non shared empty fields work fine; I have field level fallback enabled, so they fallback to the data for the us version that's the default.
I checked the underlying item, the shared field data is contained in the Fields property of the Sitecore Item; it just doesn't get mapped to the property for any other language version besides the default one. It only happens for shared fields, other fields work as expected.
- Sitecore 9.1
- SXA 1.8
- Glass Mapper 5.5.28