1

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.

Details

  • Sitecore 9.1
  • SXA 1.8
  • Glass Mapper 5.5.28

Any ideas?

3
  • For what reason did you see a need to use Glass with SXA? Commented Nov 10, 2019 at 2:10
  • @MichaelWest I just came onto the project a couple of weeks ago. These had already been decided on; not my decisions. Is there any reason you shouldn't use Glass with SXA? Commented Nov 10, 2019 at 3:18
  • 1
    It is completely not needed and generates problems. Commented Nov 10, 2019 at 6:25

1 Answer 1

0

I figured out the issue. The fact that the fields were shared was just a coincidence. Ultimately, the issue was these Multilist fields set to use a specific item type as designated by template. The language fallback wasn't set on those items nor the template's standard values; and that's ultimately what was causing the issue. Once I set the language item level fallback on the standard values of the templates, the fields started returning data.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.