U4-8720 - add IPublishedContent Site, Children ext. methods
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user