DougCouto
DougCouto

Reputation: 530

Determining if the Presentation Settings for a Sitecore Item has been overriden

This is one way of determining if the Presentation Settings of an Item have been overriden:

var contextItemPresentationSettings = Sitecore.Context.Item["__Renderings"];

var standardValuesPresentationSettings = Sitecore.Context.Item.Template.StandardValues["__Renderings"];

var presentationSettingsMatch = contextItemPresentationSettings == standardValuesPresentationSettings;

Is there a better way of determining if the Presentation Settings for an Item have been overriden?

Upvotes: 2

Views: 591

Answers (1)

Ruud van Falier
Ruud van Falier

Reputation: 8877

Use this:

Sitecore.Context.Item.Fields[Sitecore.FieldIDs.LayoutField].ContainsStandardValue

FYI, Sitecore.FieldIDs.LayoutField is a constant that hold the value of the __Renderings field ID, it's better to use those when retrieving Sitecore system fields.

Upvotes: 4

Related Questions