From 0603cb3ab13c3466573f2092e1e89ec2649227b2 Mon Sep 17 00:00:00 2001 From: Stephan Date: Tue, 19 Jul 2016 13:00:14 +0200 Subject: [PATCH] U4-8720 - add IPublishedContent Site, Children ext. methods --- src/Umbraco.Web/PublishedContentExtensions.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/Umbraco.Web/PublishedContentExtensions.cs b/src/Umbraco.Web/PublishedContentExtensions.cs index 578aab2755..95ae867e73 100644 --- a/src/Umbraco.Web/PublishedContentExtensions.cs +++ b/src/Umbraco.Web/PublishedContentExtensions.cs @@ -1746,6 +1746,11 @@ namespace Umbraco.Web return content.Children().Where(predicate); } + public static IEnumerable Children(this IPublishedContent content, params string[] alias) + { + return content.Children(x => alias.InvariantContains(x.DocumentTypeAlias)); + } + /// /// Gets the children of the content, of a given content type. /// @@ -1853,6 +1858,16 @@ namespace Umbraco.Web #endregion + #region Axes: custom + + // todo: in v8, rename this 'Root' + public static IPublishedContent Site(this IPublishedContent content) + { + return content.AncestorOrSelf(1); + } + + #endregion + #region OfTypes // the .OfType() filter is nice when there's only one type