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)
- MoveDataToSharedFromVersioned(ID fieldId, ID itemId)
within here there is a SQL query that basically selects the field value from the most recently updated version of the same item.
So basically in order to minimize data loss situations, Sitecore will always use the most recent field value for new shared value. Thought it’s rather interesting.