U4-8720 - add IPublishedContent Site, Children ext. methods

This commit is contained in:
Stephan
2016-07-19 13:00:14 +02:00
parent 6ba761df20
commit 0603cb3ab1

View File

@@ -1746,6 +1746,11 @@ namespace Umbraco.Web
return content.Children().Where(predicate);
}
public static IEnumerable<IPublishedContent> Children(this IPublishedContent content, params string[] alias)
{
return content.Children(x => alias.InvariantContains(x.DocumentTypeAlias));
}
/// <summary>
/// Gets the children of the content, of a given content type.
/// </summary>
@@ -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<T>() filter is nice when there's only one type