Created
August 31, 2012 09:38
-
-
Save janhebnes/3550874 to your computer and use it in GitHub Desktop.
Sitecore CMS - Changes to the original Language Fallback module source for allowing fallback of layout deltas on a Shared layout fields - http://trac.sitecore.net/LanguageFallback/browser/Trunk/Sitecore.SharedSource.PartialLanguageFallback/Managers/Fallba
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static string ReadFallbackValue(Field field, Item item) | |
{ | |
var fallbackItem = item.GetFallbackItem( MasterLanguage); | |
// makes 3 step renderings, currentitem -> fallback -> standard value | |
if (!TemplateManager.IsTemplate(item) && field.ID == Sitecore.FieldIDs.LayoutField && fallbackItem != null && fallbackItem.Versions.Count > 0 ) | |
{ | |
Field field1 = fallbackItem.Fields[field.ID]; | |
if (!field1.ContainsStandardValue) | |
{ | |
if (string.IsNullOrEmpty(field1.GetStandardValue())) | |
{ | |
return field1.Value; | |
} | |
return XmlDeltas.ApplyDelta(field1.GetStandardValue(), field1.Value); | |
} | |
} | |
//return fallbackItem != null && fallbackItem.Versions.Count > 0 ? fallbackItem[field.ID] : null; | |
string fallbackValue = null; | |
if (fallbackItem != null && fallbackItem.Versions.Count > 0) | |
{ | |
// There is a fallback item, lets get the value from that | |
return fallbackItem[field.ID]; | |
} | |
else if (fallbackItem != null && fallbackItem.Template.StandardValues != null && item.Versions.Count > 0) | |
{ | |
// there is no fallback item, and there is a version of me, get the fallback standardvalue | |
return fallbackItem.Template.StandardValues[field.ID]; | |
} | |
return null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment