rickbutterfield / Umbraco.Community.BlockPreview

Easy to use rich HTML backoffice previews for the Umbraco Block List and Block Grid editors.
MIT License
15 stars 10 forks source link

Adds fallback to culture defined on node #17

Closed dvandevliet closed 1 year ago

dvandevliet commented 1 year ago

This update fixes a null exception when the scope has no language set.

Explanantion For invariant content the language property is always null for the variant. The call to SetCulture will throw a null exception when passed a null value. In that case we need to set the language on the scope by retrieving the culture information for that node and use that to set the language.

dvandevliet commented 1 year ago

I was too quick with this pull request. The current code only works for a node that has culture set on itself. Running into issues with calling ancestors. So changed the status to draft for now.

dvandevliet commented 1 year ago

Updated the pull request. It now thandles these cases:

dvandevliet commented 1 year ago

I moved the fix into the controller since there was already some culture resolving taking place. The case where culture is retrieved from domains is now used also for GetMarkupForBlock.

rickbutterfield commented 1 year ago

Fixes #18 and #20