0

I would like to access the Sitecore built in "__Renderings" field as a property of a Glass model. What type can I use to do this ?

Thanks.

Yan Sklyarenko
  • 31,557
  • 24
  • 104
  • 139
epik phail
  • 195
  • 8

1 Answers1

4

To get the renderings field you should do something like this:

[SitecoreField(FieldName="__Renderings")]
public virtual string Renderings {get;set;}

If you want to handle the object as something else you will need to implement a custom data handler. You can find the tutorial on how to do this here. After that you will just need to set the datatype of the field to something like:

[SitecoreField(FieldName="__Renderings")]
public virtual IEnumerable<Rendering> Renderings {get;set;}
nsgocev
  • 4,390
  • 28
  • 37
  • 1
    When implementing you custom data handler look at the item.Visualization property and then the Sitecore.Data.Items.ItemVisualization class. – Michael Edwards Sep 18 '14 at 14:05