Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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;
- }
Add Comment
Please, Sign In to add comment