So I’ve been working on a C# script which job is to change field value sharing settings on a Sitecore template field from Versioned to Shared, something you can do in the Template Manager application by checking the _Shared _checkbox and saving.
One thought came to me. What will actually happen if I have two language versions of single item with two different values? Consider the following example. I have a versioned image field with two different values in en-US and es-ES:
So what would be the end result of making the “Image” field shared? It’s actually pretty interesting what happens after you save an item that is a template field definition.
So when a field definition item is saved, DataEngine is firing “ItemSaved” event, and the TemplateEngine has a handler for it which basically checks if either “Unversioned” or “Shared” attributes of the field definition item were changed. If there were, it runs the process of updating the field sharing settings which eventually trickles down to the data provider level where the call is made to a specially designed “FieldSharingConveter” class.
If we are making a versioned field shared, the following method is called:
- MakeSharedFromVersioned(ID fieldId)