Created
October 7, 2012 14:36
-
-
Save mikeedwards83/3848558 to your computer and use it in GitHub Desktop.
Fix for SitecoreRenderingsHandler
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 class SitecoreRenderingsHandler : AbstractSitecoreDataHandler | |
| { | |
| public override bool WillHandle(SitecoreProperty property, IEnumerable<AbstractSitecoreDataHandler> datas, Dictionary<Type, SitecoreClassConfig> classes) | |
| { | |
| //it was this: | |
| //return property.Attribute is SitecoreRenderingsAttribute && property.Property == typeof(IEnumerable<RenderingReference>); | |
| //should be this | |
| return property.Attribute is SitecoreRenderingsAttribute && property.Property.PropertyType == typeof(IEnumerable<RenderingReference>); | |
| } | |
| public override object GetValue(Item item, ISitecoreService service) | |
| { | |
| //you may want to lazy load this | |
| var device = item.Database.GetItem("/sitecore/layout/Devices/" + Device.ToString()); | |
| return item.Visualization.GetRenderings(new DeviceItem(device), false); | |
| } | |
| public override void SetValue(Item item, object value, ISitecoreService service) | |
| { | |
| throw new NotImplementedException(); | |
| } | |
| public override bool CanSetValue | |
| { | |
| get { return false; } | |
| } | |
| public override void ConfigureDataHandler(SitecoreProperty scProperty) | |
| { | |
| var attr = scProperty.Attribute as SitecoreRenderingsAttribute; | |
| this.Device = attr.Device; | |
| base.ConfigureDataHandler(scProperty); | |
| } | |
| public Device Device { get; set; } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment