Created
September 6, 2011 16:01
-
-
Save Refactored/1197983 to your computer and use it in GitHub Desktop.
Sitecore Item.IsOf
This file contains 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 static class SitecoreItemExtensions | |
{ | |
public static bool IsOf(this Sitecore.Data.Items.Item item, Sitecore.Data.ID templateId) | |
{ | |
if (item.TemplateID == templateId) return true; | |
foreach (Sitecore.Data.Items.TemplateItem ti in item.Template.BaseTemplates) | |
{ | |
if (ti.ID == templateId) return true; | |
} | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment