Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Umbraco.Core/Extensions/PublishedContentExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,7 @@ static IEnumerable<IPublishedContent> TakeUntil(IEnumerable<IPublishedContent> s
/// </param>
/// <returns></returns>
/// <remarks>
/// This can be useful in order to return all nodes in an entire site by a type when combined with TypedContentAtRoot
/// This can be useful in order to return all nodes in an entire site by a type when combined with ContentAtRoot
/// </remarks>
public static IEnumerable<IPublishedContent> DescendantsOrSelfOfType(
this IEnumerable<IPublishedContent> parentNodes, IVariationContextAccessor variationContextAccessor, string docTypeAlias, string? culture = null) => parentNodes.SelectMany(x =>
Expand All @@ -843,7 +843,7 @@ public static IEnumerable<IPublishedContent> DescendantsOrSelfOfType(
/// </param>
/// <returns></returns>
/// <remarks>
/// This can be useful in order to return all nodes in an entire site by a type when combined with TypedContentAtRoot
/// This can be useful in order to return all nodes in an entire site by a type when combined with ContentAtRoot
/// </remarks>
public static IEnumerable<T> DescendantsOrSelf<T>(this IEnumerable<IPublishedContent> parentNodes, IVariationContextAccessor variationContextAccessor, string? culture = null)
where T : class, IPublishedContent =>
Expand Down
2 changes: 2 additions & 0 deletions src/Umbraco.Infrastructure/IPublishedContentQuery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ public interface IPublishedContentQuery

IEnumerable<IPublishedContent> ContentAtRoot();

IEnumerable<IPublishedContent> ContentAtRoot(string? culture) => culture is null ? ContentAtRoot() : throw new NotSupportedException();

IPublishedContent? Media(int id);

IPublishedContent? Media(Guid id);
Expand Down
7 changes: 5 additions & 2 deletions src/Umbraco.Infrastructure/PublishedContentQuery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ public IEnumerable<IPublishedContent> ContentAtXPath(XPathExpression xpath, para
public IEnumerable<IPublishedContent> ContentAtRoot()
=> ItemsAtRoot(_publishedSnapshot.Content);

public IEnumerable<IPublishedContent> ContentAtRoot(string? culture)
=> ItemsAtRoot(_publishedSnapshot.Content, culture);

#endregion

#region Media
Expand Down Expand Up @@ -232,8 +235,8 @@ private static IEnumerable<IPublishedContent> ItemsByXPath(XPathExpression xpath
IPublishedCache? cache)
=> cache?.GetByXPath(xpath, vars) ?? Array.Empty<IPublishedContent>();

private static IEnumerable<IPublishedContent> ItemsAtRoot(IPublishedCache? cache)
=> cache?.GetAtRoot() ?? Array.Empty<IPublishedContent>();
private static IEnumerable<IPublishedContent> ItemsAtRoot(IPublishedCache? cache, string? culture = null)
=> cache?.GetAtRoot(culture) ?? Array.Empty<IPublishedContent>();

#endregion

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ public static bool HasValue(
/// </param>
/// <returns></returns>
/// <remarks>
/// This can be useful in order to return all nodes in an entire site by a type when combined with TypedContentAtRoot
/// This can be useful in order to return all nodes in an entire site by a type when combined with ContentAtRoot
/// </remarks>
public static IEnumerable<IPublishedContent> DescendantsOrSelfOfType(
this IEnumerable<IPublishedContent> parentNodes, string docTypeAlias, string? culture = null)
Expand All @@ -227,7 +227,7 @@ public static IEnumerable<IPublishedContent> DescendantsOrSelfOfType(
/// </param>
/// <returns></returns>
/// <remarks>
/// This can be useful in order to return all nodes in an entire site by a type when combined with TypedContentAtRoot
/// This can be useful in order to return all nodes in an entire site by a type when combined with ContentAtRoot
/// </remarks>
public static IEnumerable<T> DescendantsOrSelf<T>(
this IEnumerable<IPublishedContent> parentNodes,
Expand Down
2 changes: 2 additions & 0 deletions src/Umbraco.Web.Common/UmbracoHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,8 @@ public IEnumerable<IPublishedContent> ContentAtXPath(XPathExpression xpath, para

public IEnumerable<IPublishedContent> ContentAtRoot() => _publishedContentQuery.ContentAtRoot();
Comment thread
AndyButland marked this conversation as resolved.

Comment thread
bjarnef marked this conversation as resolved.
public IEnumerable<IPublishedContent> ContentAtRoot(string? culture) => _publishedContentQuery.ContentAtRoot(culture);

#endregion

#region Media
Expand Down
Loading