diff --git a/src/Sitecore.Commons/Extensions/ItemExtensions.cs b/src/Sitecore.Commons/Extensions/ItemExtensions.cs index 68d4c5b..ccb570d 100644 --- a/src/Sitecore.Commons/Extensions/ItemExtensions.cs +++ b/src/Sitecore.Commons/Extensions/ItemExtensions.cs @@ -167,6 +167,42 @@ public static bool IsOfTemplate(this Item item, string templateId) return (item.TemplateID.ToString() == templateId); } + /// + /// check to verify that the item is of passed template + /// + /// + /// + /// + public static bool IsOfTemplate(this Item item, ID templateId) + { + return item.IsOfTemplate(templateId.ToString()); + } + + /// + /// Will check the item's template, if deep is enabled it will check item's base templates + /// This signature should be avoided because of potential performance issues. If you MUST recurse along template inheritance prefer passing depth as an int and work to minimised its value + /// + /// + /// + /// + /// + public static bool IsOfTemplate(this Item item, ID templateId, bool deep) + { + return item.IsOfTemplate(templateId.ToString(), deep); + } + + /// + /// Will check the item's template, if depth is non-zero it will recurse down the item's base templates + /// + /// + /// + /// 0 = 'Do not recurse', -1 = 'recurse as far as system base template', n = 'recurse a maximum of n times' + /// + public static bool IsOfTemplate(this Item item, ID templateId, int depth) + { + return item.IsOfTemplate(templateId.ToString(), depth); + } + /// /// Checks to see if an item is null ///