daily pastebin goal
14%
SHARE
TWEET

Untitled

a guest Dec 14th, 2018 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         public static string ReadFallbackValue(Field field, Item item)
  2.         {
  3.             var fallbackItem = item.GetFallbackItem( MasterLanguage);
  4.  
  5.             // makes 3 step renderings, currentitem -> fallback -> standard value
  6.             if (!TemplateManager.IsTemplate(item) && field.ID == Sitecore.FieldIDs.LayoutField && fallbackItem != null && fallbackItem.Versions.Count > 0 )
  7.             {
  8.                 Field field1 = fallbackItem.Fields[field.ID];
  9.                 if (!field1.ContainsStandardValue)
  10.                 {
  11.                     if (string.IsNullOrEmpty(field1.GetStandardValue()))
  12.                     {
  13.                         return field1.Value;
  14.                     }
  15.  
  16.                     return XmlDeltas.ApplyDelta(field1.GetStandardValue(), field1.Value);
  17.                 }
  18.             }
  19.  
  20.             //return fallbackItem != null && fallbackItem.Versions.Count > 0 ? fallbackItem[field.ID] : null;
  21.  
  22.             string fallbackValue = null;
  23.  
  24.             if (fallbackItem != null && fallbackItem.Versions.Count > 0)
  25.             {
  26.                 // There is a fallback item, lets get the value from that
  27.                 return fallbackItem[field.ID];
  28.             }
  29.             else if (fallbackItem != null && fallbackItem.Template.StandardValues != null && item.Versions.Count > 0)
  30.             {
  31.                 // there is no fallback item, and there is a version of me, get the fallback standardvalue
  32.                 return fallbackItem.Template.StandardValues[field.ID];
  33.             }
  34.  
  35.             return null;
  36.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top