Class PublishedContentExtensions
Provides extension methods for IPublishedContent to navigate content trees, access properties, and retrieve related content such as ancestors, descendants, siblings, and children.
Inheritance
Namespace: Umbraco.Extensions
Assembly: Umbraco.Core.dll
Syntax
public static class PublishedContentExtensions
Methods
View SourceAncestor(IPublishedContent, int)
Gets an ancestor of the content item up to a maximum level.
Declaration
public static IPublishedContent? Ancestor(this IPublishedContent content, int maxLevel)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| int | maxLevel | The maximum level to traverse. |
Returns
| Type | Description |
|---|---|
| IPublishedContent | The ancestor at or below the maximum level, or null if not found. |
Ancestor(IPublishedContent, string)
Gets an ancestor of the content item of a specific content type.
Declaration
public static IPublishedContent? Ancestor(this IPublishedContent content, string contentTypeAlias)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| string | contentTypeAlias | The content type alias to find. |
Returns
| Type | Description |
|---|---|
| IPublishedContent | The first ancestor of the specified type, or null if not found. |
Ancestor(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService)
Gets the ancestor of the content, ie its parent.
Declaration
public static IPublishedContent? Ancestor(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content. |
| INavigationQueryService | navigationQueryService | The query service for the in-memory navigation structure. |
| IPublishedStatusFilteringService | publishedStatusFilteringService |
Returns
| Type | Description |
|---|---|
| IPublishedContent | The ancestor of the content. |
Remarks
This method is here for consistency purposes but does not make much sense.
Ancestor(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService, int)
Gets the nearest ancestor of the content, at a lever lesser or equal to a specified level.
Declaration
public static IPublishedContent? Ancestor(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, int maxLevel)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content. |
| INavigationQueryService | navigationQueryService | The query service for the in-memory navigation structure. |
| IPublishedStatusFilteringService | publishedStatusFilteringService | |
| int | maxLevel | The level. |
Returns
| Type | Description |
|---|---|
| IPublishedContent | The nearest (in down-top order) ancestor of the content, at a level lesser or equal to the specified level. |
Remarks
Does not consider the content itself. May return null.
Ancestor(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService, string)
Gets the nearest ancestor of the content, of a specified content type.
Declaration
public static IPublishedContent? Ancestor(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, string contentTypeAlias)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content. |
| INavigationQueryService | navigationQueryService | The query service for the in-memory navigation structure. |
| IPublishedStatusFilteringService | publishedStatusFilteringService | |
| string | contentTypeAlias | The content type alias. |
Returns
| Type | Description |
|---|---|
| IPublishedContent | The nearest (in down-top order) ancestor of the content, of the specified content type. |
Remarks
Does not consider the content itself. May return null.
AncestorOrSelf(IPublishedContent)
Gets the content or its nearest ancestor.
Declaration
public static IPublishedContent AncestorOrSelf(this IPublishedContent content)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content. |
Returns
| Type | Description |
|---|---|
| IPublishedContent | The content. |
Remarks
This method is here for consistency purposes but does not make much sense.
AncestorOrSelf(IPublishedContent, int)
Gets an ancestor or self of the content item at or below a maximum level.
Declaration
public static IPublishedContent AncestorOrSelf(this IPublishedContent content, int maxLevel)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| int | maxLevel | The maximum level to traverse. |
Returns
| Type | Description |
|---|---|
| IPublishedContent | The content item or an ancestor at or below the maximum level. |
AncestorOrSelf(IPublishedContent, string)
Gets an ancestor or self of the content item of a specific content type.
Declaration
public static IPublishedContent AncestorOrSelf(this IPublishedContent content, string contentTypeAlias)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| string | contentTypeAlias | The content type alias to find. |
Returns
| Type | Description |
|---|---|
| IPublishedContent | The content item or an ancestor of the specified type. |
AncestorOrSelf(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService, int)
Gets the content or its nearest ancestor, at a lever lesser or equal to a specified level.
Declaration
public static IPublishedContent AncestorOrSelf(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, int maxLevel)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content. |
| INavigationQueryService | navigationQueryService | The query service for the in-memory navigation structure. |
| IPublishedStatusFilteringService | publishedStatusFilteringService | |
| int | maxLevel | The level. |
Returns
| Type | Description |
|---|---|
| IPublishedContent | The content or its nearest (in down-top order) ancestor, at a level lesser or equal to the specified level. |
Remarks
May or may not return the content itself depending on its level. May return null.
AncestorOrSelf(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService, string)
Gets the content or its nearest ancestor, of a specified content type.
Declaration
public static IPublishedContent AncestorOrSelf(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, string contentTypeAlias)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content. |
| INavigationQueryService | navigationQueryService | The query service for the in-memory navigation structure. |
| IPublishedStatusFilteringService | publishedStatusFilteringService | |
| string | contentTypeAlias | The content type. |
Returns
| Type | Description |
|---|---|
| IPublishedContent | The content or its nearest (in down-top order) ancestor, of the specified content type. |
Remarks
May or may not return the content itself depending on its content type. May return null.
AncestorOrSelf<T>(IPublishedContent, int)
Gets an ancestor or self of the content item of a specific type up to a maximum level.
Declaration
public static T? AncestorOrSelf<T>(this IPublishedContent content, int maxLevel) where T : class, IPublishedContent
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| int | maxLevel | The maximum level to traverse. |
Returns
| Type | Description |
|---|---|
| T | The content item or an ancestor of the specified type at or below the maximum level, or null if not found. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of content to return. |
AncestorOrSelf<T>(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService)
Gets the content or its nearest ancestor, of a specified content type.
Declaration
public static T? AncestorOrSelf<T>(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService) where T : class, IPublishedContent
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content. |
| INavigationQueryService | navigationQueryService | The query service for the in-memory navigation structure. |
| IPublishedStatusFilteringService | publishedStatusFilteringService |
Returns
| Type | Description |
|---|---|
| T | The content or its nearest (in down-top order) ancestor, of the specified content type. |
Type Parameters
| Name | Description |
|---|---|
| T | The content type. |
Remarks
May or may not return the content itself depending on its content type. May return null.
AncestorOrSelf<T>(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService, int)
Gets the content or its nearest ancestor, at a lever lesser or equal to a specified level, and of a specified content type.
Declaration
public static T? AncestorOrSelf<T>(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, int maxLevel) where T : class, IPublishedContent
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content. |
| INavigationQueryService | navigationQueryService | The query service for the in-memory navigation structure. |
| IPublishedStatusFilteringService | publishedStatusFilteringService | |
| int | maxLevel | The level. |
Returns
| Type | Description |
|---|---|
| T |
Type Parameters
| Name | Description |
|---|---|
| T | The content type. |
Ancestor<T>(IPublishedContent, int)
Gets an ancestor of the content item of a specific type up to a maximum level.
Declaration
public static T? Ancestor<T>(this IPublishedContent content, int maxLevel) where T : class, IPublishedContent
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| int | maxLevel | The maximum level to traverse. |
Returns
| Type | Description |
|---|---|
| T | The ancestor of the specified type at or below the maximum level, or null if not found. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of content to return. |
Ancestor<T>(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService)
Gets the nearest ancestor of the content, of a specified content type.
Declaration
public static T? Ancestor<T>(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService) where T : class, IPublishedContent
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content. |
| INavigationQueryService | navigationQueryService | The query service for the in-memory navigation structure. |
| IPublishedStatusFilteringService | publishedStatusFilteringService |
Returns
| Type | Description |
|---|---|
| T | The nearest (in down-top order) ancestor of the content, of the specified content type. |
Type Parameters
| Name | Description |
|---|---|
| T | The content type. |
Remarks
Does not consider the content itself. May return null.
Ancestor<T>(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService, int)
Gets the nearest ancestor of the content, at the specified level and of the specified content type.
Declaration
public static T? Ancestor<T>(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, int maxLevel) where T : class, IPublishedContent
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content. |
| INavigationQueryService | navigationQueryService | The query service for the in-memory navigation structure. |
| IPublishedStatusFilteringService | publishedStatusFilteringService | |
| int | maxLevel | The level. |
Returns
| Type | Description |
|---|---|
| T | The ancestor of the content, at the specified level and of the specified content type. |
Type Parameters
| Name | Description |
|---|---|
| T | The content type. |
Remarks
Does not consider the content itself. If the ancestor at the specified level is
not of the specified type, returns null.
Ancestors(IPublishedContent, int)
Gets the ancestors of the content item up to a maximum level.
Declaration
public static IEnumerable<IPublishedContent> Ancestors(this IPublishedContent content, int maxLevel)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| int | maxLevel | The maximum level to traverse. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IPublishedContent> | An enumerable of ancestors at or below the maximum level. |
Ancestors(IPublishedContent, string)
Gets the ancestors of the content item of a specific content type.
Declaration
public static IEnumerable<IPublishedContent> Ancestors(this IPublishedContent content, string contentTypeAlias)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| string | contentTypeAlias | The content type alias to filter by. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IPublishedContent> | An enumerable of ancestors of the specified type. |
Ancestors(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService)
Gets the ancestors of the content.
Declaration
public static IEnumerable<IPublishedContent> Ancestors(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content. |
| INavigationQueryService | navigationQueryService | The query service for the in-memory navigation structure. |
| IPublishedStatusFilteringService | publishedStatusFilteringService |
Returns
| Type | Description |
|---|---|
| IEnumerable<IPublishedContent> | The ancestors of the content, in down-top order. |
Remarks
Does not consider the content itself.
Ancestors(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService, int)
Gets the ancestors of the content, at a level lesser or equal to a specified level.
Declaration
public static IEnumerable<IPublishedContent> Ancestors(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, int maxLevel)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content. |
| INavigationQueryService | navigationQueryService | The query service for the in-memory navigation structure. |
| IPublishedStatusFilteringService | publishedStatusFilteringService | |
| int | maxLevel | The level. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IPublishedContent> | The ancestors of the content, at a level lesser or equal to the specified level, in down-top order. |
Remarks
Does not consider the content itself. Only content that are "high enough" in the tree are returned.
Ancestors(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService, string)
Gets the ancestors of the content, of a specified content type.
Declaration
public static IEnumerable<IPublishedContent> Ancestors(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, string contentTypeAlias)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content. |
| INavigationQueryService | navigationQueryService | The query service for the in-memory navigation structure. |
| IPublishedStatusFilteringService | publishedStatusFilteringService | |
| string | contentTypeAlias | The content type. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IPublishedContent> | The ancestors of the content, of the specified content type, in down-top order. |
Remarks
Does not consider the content itself. Returns all ancestors, of the specified content type.
AncestorsOrSelf(IPublishedContent, bool, Func<IPublishedContent, bool>?)
Gets the ancestors or self of the content item, optionally filtered by a predicate.
Declaration
public static IEnumerable<IPublishedContent> AncestorsOrSelf(this IPublishedContent content, bool orSelf, Func<IPublishedContent, bool>? func)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| bool | orSelf | Whether to include the content item itself. |
| Func<IPublishedContent, bool> | func | An optional predicate to filter the ancestors. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IPublishedContent> | An enumerable of the content item and/or its ancestors matching the criteria. |
AncestorsOrSelf(IPublishedContent, int)
Gets the ancestors or self of the content item up to a maximum level.
Declaration
public static IEnumerable<IPublishedContent> AncestorsOrSelf(this IPublishedContent content, int maxLevel)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| int | maxLevel | The maximum level to traverse. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IPublishedContent> | An enumerable of the content item and its ancestors at or below the maximum level. |
AncestorsOrSelf(IPublishedContent, string)
Gets the ancestors or self of the content item of a specific content type.
Declaration
public static IEnumerable<IPublishedContent> AncestorsOrSelf(this IPublishedContent content, string contentTypeAlias)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| string | contentTypeAlias | The content type alias to filter by. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IPublishedContent> | An enumerable of the content item and its ancestors of the specified type. |
AncestorsOrSelf(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService)
Gets the content and its ancestors.
Declaration
public static IEnumerable<IPublishedContent> AncestorsOrSelf(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content. |
| INavigationQueryService | navigationQueryService | The query service for the in-memory navigation structure. |
| IPublishedStatusFilteringService | publishedStatusFilteringService |
Returns
| Type | Description |
|---|---|
| IEnumerable<IPublishedContent> | The content and its ancestors, in down-top order. |
AncestorsOrSelf(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService, bool, Func<IPublishedContent, bool>?)
Gets the ancestors or self of the content item, optionally filtered by a predicate.
Declaration
public static IEnumerable<IPublishedContent> AncestorsOrSelf(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, bool orSelf, Func<IPublishedContent, bool>? func)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| INavigationQueryService | navigationQueryService | The navigation query service. |
| IPublishedStatusFilteringService | publishedStatusFilteringService | The published status filtering service. |
| bool | orSelf | Whether to include the content item itself. |
| Func<IPublishedContent, bool> | func | An optional predicate to filter the ancestors. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IPublishedContent> | An enumerable of ancestors or self matching the criteria. |
AncestorsOrSelf(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService, int)
Gets the content and its ancestors, at a level lesser or equal to a specified level.
Declaration
public static IEnumerable<IPublishedContent> AncestorsOrSelf(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, int maxLevel)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content. |
| INavigationQueryService | navigationQueryService | The query service for the in-memory navigation structure. |
| IPublishedStatusFilteringService | publishedStatusFilteringService | |
| int | maxLevel | The level. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IPublishedContent> | The content and its ancestors, at a level lesser or equal to the specified level, in down-top order. |
Remarks
Only content that are "high enough" in the tree are returned. So it may or may not begin with the content itself, depending on its level.
AncestorsOrSelf(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService, string)
Gets the content and its ancestors, of a specified content type.
Declaration
public static IEnumerable<IPublishedContent> AncestorsOrSelf(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, string contentTypeAlias)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content. |
| INavigationQueryService | navigationQueryService | The query service for the in-memory navigation structure. |
| IPublishedStatusFilteringService | publishedStatusFilteringService | |
| string | contentTypeAlias | The content type. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IPublishedContent> | The content and its ancestors, of the specified content type, in down-top order. |
Remarks
May or may not begin with the content itself, depending on its content type.
AncestorsOrSelf<T>(IPublishedContent, int)
Gets the ancestors or self of the content item of a specific type up to a maximum level.
Declaration
public static IEnumerable<T> AncestorsOrSelf<T>(this IPublishedContent content, int maxLevel) where T : class, IPublishedContent
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| int | maxLevel | The maximum level to traverse. |
Returns
| Type | Description |
|---|---|
| IEnumerable<T> | An enumerable of the content item and its ancestors of the specified type at or below the maximum level. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of content to return. |
AncestorsOrSelf<T>(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService)
Gets the content and its ancestors, of a specified content type.
Declaration
public static IEnumerable<T> AncestorsOrSelf<T>(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService) where T : class, IPublishedContent
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content. |
| INavigationQueryService | navigationQueryService | The query service for the in-memory navigation structure. |
| IPublishedStatusFilteringService | publishedStatusFilteringService |
Returns
| Type | Description |
|---|---|
| IEnumerable<T> | The content and its ancestors, of the specified content type, in down-top order. |
Type Parameters
| Name | Description |
|---|---|
| T | The content type. |
Remarks
May or may not begin with the content itself, depending on its content type.
AncestorsOrSelf<T>(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService, int)
Gets the content and its ancestor, at a lever lesser or equal to a specified level, and of a specified content type.
Declaration
public static IEnumerable<T> AncestorsOrSelf<T>(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, int maxLevel) where T : class, IPublishedContent
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content. |
| INavigationQueryService | navigationQueryService | The query service for the in-memory navigation structure. |
| IPublishedStatusFilteringService | publishedStatusFilteringService | |
| int | maxLevel | The level. |
Returns
| Type | Description |
|---|---|
| IEnumerable<T> | The content and its ancestors, at a level lesser or equal to the specified level, and of the specified content type, in down-top order. |
Type Parameters
| Name | Description |
|---|---|
| T | The content type. |
Remarks
May or may not begin with the content itself, depending on its level and content type.
Ancestors<T>(IPublishedContent)
Gets the ancestors of the content item of a specific type.
Declaration
public static IEnumerable<T> Ancestors<T>(this IPublishedContent content) where T : class, IPublishedContent
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
Returns
| Type | Description |
|---|---|
| IEnumerable<T> | An enumerable of ancestors of the specified type. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of content to return. |
Ancestors<T>(IPublishedContent, int)
Gets the ancestors of the content item of a specific type up to a maximum level.
Declaration
public static IEnumerable<T> Ancestors<T>(this IPublishedContent content, int maxLevel) where T : class, IPublishedContent
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| int | maxLevel | The maximum level to traverse. |
Returns
| Type | Description |
|---|---|
| IEnumerable<T> | An enumerable of ancestors of the specified type at or below the maximum level. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of content to return. |
Ancestors<T>(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService)
Gets the ancestors of the content, of a specified content type.
Declaration
public static IEnumerable<T> Ancestors<T>(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService) where T : class, IPublishedContent
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content. |
| INavigationQueryService | navigationQueryService | The query service for the in-memory navigation structure. |
| IPublishedStatusFilteringService | publishedStatusFilteringService |
Returns
| Type | Description |
|---|---|
| IEnumerable<T> | The ancestors of the content, of the specified content type, in down-top order. |
Type Parameters
| Name | Description |
|---|---|
| T | The content type. |
Remarks
Does not consider the content itself. Returns all ancestors, of the specified content type.
Ancestors<T>(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService, int)
Gets the ancestors of the content, at a level lesser or equal to a specified level, and of a specified content type.
Declaration
public static IEnumerable<T> Ancestors<T>(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, int maxLevel) where T : class, IPublishedContent
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content. |
| INavigationQueryService | navigationQueryService | The query service for the in-memory navigation structure. |
| IPublishedStatusFilteringService | publishedStatusFilteringService | The service for filtering published content by status. |
| int | maxLevel | The level. |
Returns
| Type | Description |
|---|---|
| IEnumerable<T> | The ancestors of the content, at a level lesser or equal to the specified level, and of the specified content type, in down-top order. |
Type Parameters
| Name | Description |
|---|---|
| T | The content type. |
Remarks
Does not consider the content itself. Only content that are "high enough" in the trees, and of the specified content type, are returned.
Breadcrumbs(IPublishedContent, bool)
Gets the breadcrumbs (ancestors and self, top to bottom) for the content item.
Declaration
public static IEnumerable<IPublishedContent> Breadcrumbs(this IPublishedContent content, bool andSelf = true)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| bool | andSelf | Whether to include the content item itself. Default is true. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IPublishedContent> | An enumerable of the breadcrumb trail from root to the content item. |
Breadcrumbs(IPublishedContent, int, bool)
Gets the breadcrumbs (ancestors and self, top to bottom) for the content item at or above a minimum level.
Declaration
public static IEnumerable<IPublishedContent> Breadcrumbs(this IPublishedContent content, int minLevel, bool andSelf = true)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| int | minLevel | The minimum level to include in the breadcrumbs. |
| bool | andSelf | Whether to include the content item itself. Default is true. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IPublishedContent> | An enumerable of the breadcrumb trail from the minimum level to the content item. |
Breadcrumbs(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService, bool)
Gets the breadcrumbs (ancestors and self, top to bottom) for the specified content.
Declaration
public static IEnumerable<IPublishedContent> Breadcrumbs(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, bool andSelf = true)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content. |
| INavigationQueryService | navigationQueryService | The query service for the in-memory navigation structure. |
| IPublishedStatusFilteringService | publishedStatusFilteringService | |
| bool | andSelf | Indicates whether the specified content should be included. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IPublishedContent> | The breadcrumbs (ancestors and self, top to bottom) for the specified |
Breadcrumbs(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService, int, bool)
Gets the breadcrumbs (ancestors and self, top to bottom) for the specified content at a level
higher or equal to minLevel.
Declaration
public static IEnumerable<IPublishedContent> Breadcrumbs(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, int minLevel, bool andSelf = true)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content. |
| INavigationQueryService | navigationQueryService | The query service for the in-memory navigation structure. |
| IPublishedStatusFilteringService | publishedStatusFilteringService | |
| int | minLevel | The minimum level. |
| bool | andSelf | Indicates whether the specified content should be included. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IPublishedContent> | The breadcrumbs (ancestors and self, top to bottom) for the specified |
Breadcrumbs<T>(IPublishedContent, bool)
Gets the breadcrumbs (ancestors and self, top to bottom) for the content item of a specific type.
Declaration
public static IEnumerable<IPublishedContent> Breadcrumbs<T>(this IPublishedContent content, bool andSelf = true) where T : class, IPublishedContent
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| bool | andSelf | Whether to include the content item itself. Default is true. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IPublishedContent> | An enumerable of the breadcrumb trail of the specified type. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of content to include in the breadcrumbs. |
Breadcrumbs<T>(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService, bool)
Gets the breadcrumbs (ancestors and self, top to bottom) for the specified content at a level
higher or equal to the specified root content type T.
Declaration
public static IEnumerable<IPublishedContent> Breadcrumbs<T>(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, bool andSelf = true) where T : class, IPublishedContent
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content. |
| INavigationQueryService | navigationQueryService | The query service for the in-memory navigation structure. |
| IPublishedStatusFilteringService | publishedStatusFilteringService | |
| bool | andSelf | Indicates whether the specified content should be included. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IPublishedContent> | The breadcrumbs (ancestors and self, top to bottom) for the specified |
Type Parameters
| Name | Description |
|---|---|
| T | The root content type. |
Children(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService, Func<IPublishedContent, bool>, string?)
Gets the children of the content, filtered by a predicate.
Declaration
public static IEnumerable<IPublishedContent> Children(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, Func<IPublishedContent, bool> predicate, string? culture = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content. |
| INavigationQueryService | navigationQueryService | The navigation query service. |
| IPublishedStatusFilteringService | publishedStatusFilteringService | The published status filtering service. |
| Func<IPublishedContent, bool> | predicate | The predicate. |
| string | culture | The specific culture to filter for. If null is used the current culture is used. (Default is null) |
Returns
| Type | Description |
|---|---|
| IEnumerable<IPublishedContent> | The children of the content, filtered by the predicate. |
Remarks
Children are sorted by their sortOrder.
Children(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService, string?)
Gets the children of the content item.
Declaration
public static IEnumerable<IPublishedContent> Children(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, string? culture = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| INavigationQueryService | navigationQueryService | The navigation query service. |
| IPublishedStatusFilteringService | publishedStatusFilteringService | The published status filtering service. |
| string | culture | The specific culture to get the URL children for. Default is null which will use the current culture in VariationContext |
Returns
| Type | Description |
|---|---|
| IEnumerable<IPublishedContent> |
Remarks
Gets children that are available for the specified culture.
Children are sorted by their sortOrder.
For culture, if null is used the current culture is used. If an empty string is used only invariant children are returned. If "*" is used all children are returned.
If a variant culture is specified or there is a current culture in the VariationContext then the Children returned will include both the variant children matching the culture AND the invariant children because the invariant children flow with the current culture. However, if an empty string is specified only invariant children are returned.
ChildrenOfType(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService, string?, string?)
Gets the children of the content, of any of the specified types.
Declaration
public static IEnumerable<IPublishedContent> ChildrenOfType(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, string? contentTypeAlias, string? culture = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content. |
| INavigationQueryService | navigationQueryService | |
| IPublishedStatusFilteringService | publishedStatusFilteringService | |
| string | contentTypeAlias | The content type alias. |
| string | culture | The specific culture to filter for. If null is used the current culture is used. (Default is null) |
Returns
| Type | Description |
|---|---|
| IEnumerable<IPublishedContent> | The children of the content, of any of the specified types. |
Children<T>(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService, string?)
Gets the children of the content, of a given content type.
Declaration
public static IEnumerable<T> Children<T>(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, string? culture = null) where T : class, IPublishedContent
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content. |
| INavigationQueryService | navigationQueryService | The query service for the in-memory navigation structure. |
| IPublishedStatusFilteringService | publishedStatusFilteringService | The service for filtering published content by status. |
| string | culture | The specific culture to filter for. If null is used the current culture is used. (Default is null) |
Returns
| Type | Description |
|---|---|
| IEnumerable<T> | The children of content, of the given content type. |
Type Parameters
| Name | Description |
|---|---|
| T | The content type. |
Remarks
Children are sorted by their sortOrder.
CreatorName(IPublishedContent, IUserService)
Gets the name of the content item creator.
Declaration
public static string? CreatorName(this IPublishedContent content, IUserService userService)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| IUserService | userService |
Returns
| Type | Description |
|---|---|
| string |
CultureDate(IPublishedContent, IVariationContextAccessor, string?)
Gets the culture date of the content item.
Declaration
public static DateTime CultureDate(this IPublishedContent content, IVariationContextAccessor variationContextAccessor, string? culture = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| IVariationContextAccessor | variationContextAccessor | |
| string | culture | The specific culture to get the name for. If null is used the current culture is used (Default is null). |
Returns
| Type | Description |
|---|---|
| DateTime |
Descendant(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService, int, string?)
Gets the first descendant of the content item at a specified level.
Declaration
public static IPublishedContent? Descendant(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, int level, string? culture = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| INavigationQueryService | navigationQueryService | The navigation query service. |
| IPublishedStatusFilteringService | publishedStatusFilteringService | The published status filtering service. |
| int | level | The level to find a descendant at. |
| string | culture | The culture for variant content. |
Returns
| Type | Description |
|---|---|
| IPublishedContent | The first descendant at the specified level, or null if none exists. |
Descendant(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService, string?)
Gets the first descendant of the content item.
Declaration
public static IPublishedContent? Descendant(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, string? culture = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| INavigationQueryService | navigationQueryService | The navigation query service. |
| IPublishedStatusFilteringService | publishedStatusFilteringService | The published status filtering service. |
| string | culture | The culture for variant content. |
Returns
| Type | Description |
|---|---|
| IPublishedContent | The first descendant, or null if none exists. |
DescendantOfType(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService, string, string?)
Gets the first descendant of the content item of a specific content type.
Declaration
public static IPublishedContent? DescendantOfType(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, string contentTypeAlias, string? culture = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| INavigationQueryService | navigationQueryService | The navigation query service. |
| IPublishedStatusFilteringService | publishedStatusFilteringService | The published status filtering service. |
| string | contentTypeAlias | The content type alias to filter by. |
| string | culture | The culture for variant content. |
Returns
| Type | Description |
|---|---|
| IPublishedContent | The first descendant of the specified type, or null if none exists. |
DescendantOrSelf(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService, int, string?)
Gets the first descendant or self of the content item at a specified level.
Declaration
public static IPublishedContent? DescendantOrSelf(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, int level, string? culture = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| INavigationQueryService | navigationQueryService | The navigation query service. |
| IPublishedStatusFilteringService | publishedStatusFilteringService | The published status filtering service. |
| int | level | The level to find a descendant at. |
| string | culture | The culture for variant content. |
Returns
| Type | Description |
|---|---|
| IPublishedContent | The first descendant or self at the specified level, or null if none exists. |
DescendantOrSelf(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService, string?)
Gets the first descendant or self of the content item.
Declaration
public static IPublishedContent DescendantOrSelf(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, string? culture = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| INavigationQueryService | navigationQueryService | The navigation query service. |
| IPublishedStatusFilteringService | publishedStatusFilteringService | The published status filtering service. |
| string | culture | The culture for variant content. |
Returns
| Type | Description |
|---|---|
| IPublishedContent | The first descendant, or the content item itself if no descendants exist. |
DescendantOrSelfOfType(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService, string, string?)
Gets the first descendant or self of the content item of a specific content type.
Declaration
public static IPublishedContent? DescendantOrSelfOfType(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, string contentTypeAlias, string? culture = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| INavigationQueryService | navigationQueryService | The navigation query service. |
| IPublishedStatusFilteringService | publishedStatusFilteringService | The published status filtering service. |
| string | contentTypeAlias | The content type alias to filter by. |
| string | culture | The culture for variant content. |
Returns
| Type | Description |
|---|---|
| IPublishedContent | The first descendant or self of the specified type, or null if none exists. |
DescendantOrSelf<T>(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService, int, string?)
Gets the first descendant or self of the content item of a specific type at a specified level.
Declaration
public static T? DescendantOrSelf<T>(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, int level, string? culture = null) where T : class, IPublishedContent
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| INavigationQueryService | navigationQueryService | The navigation query service. |
| IPublishedStatusFilteringService | publishedStatusFilteringService | The published status filtering service. |
| int | level | The level to find a descendant at. |
| string | culture | The culture for variant content. |
Returns
| Type | Description |
|---|---|
| T | The first descendant or self of the specified type at the level, or null if none exists. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of content to return. |
DescendantOrSelf<T>(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService, string?)
Gets the first descendant or self of the content item of a specific type.
Declaration
public static T? DescendantOrSelf<T>(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, string? culture = null) where T : class, IPublishedContent
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| INavigationQueryService | navigationQueryService | The navigation query service. |
| IPublishedStatusFilteringService | publishedStatusFilteringService | The published status filtering service. |
| string | culture | The culture for variant content. |
Returns
| Type | Description |
|---|---|
| T | The first descendant or self of the specified type, or null if none exists. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of content to return. |
Descendant<T>(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService, int, string?)
Gets the first descendant of the content item of a specific type at a specified level.
Declaration
public static T? Descendant<T>(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, int level, string? culture = null) where T : class, IPublishedContent
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| INavigationQueryService | navigationQueryService | The navigation query service. |
| IPublishedStatusFilteringService | publishedStatusFilteringService | The published status filtering service. |
| int | level | The level to find a descendant at. |
| string | culture | The culture for variant content. |
Returns
| Type | Description |
|---|---|
| T | The first descendant of the specified type at the level, or null if none exists. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of content to return. |
Descendant<T>(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService, string?)
Gets the first descendant of the content item of a specific type.
Declaration
public static T? Descendant<T>(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, string? culture = null) where T : class, IPublishedContent
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| INavigationQueryService | navigationQueryService | The navigation query service. |
| IPublishedStatusFilteringService | publishedStatusFilteringService | The published status filtering service. |
| string | culture | The culture for variant content. |
Returns
| Type | Description |
|---|---|
| T | The first descendant of the specified type, or null if none exists. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of content to return. |
Descendants(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService, int, string?)
Gets all descendants of the content item at or above a specified level.
Declaration
public static IEnumerable<IPublishedContent> Descendants(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, int level, string? culture = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| INavigationQueryService | navigationQueryService | The navigation query service. |
| IPublishedStatusFilteringService | publishedStatusFilteringService | The published status filtering service. |
| int | level | The minimum level of descendants to return. |
| string | culture | The culture for variant content. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IPublishedContent> | An enumerable of descendant content items at or above the specified level. |
Descendants(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService, string?)
Gets all descendants of the content item.
Declaration
public static IEnumerable<IPublishedContent> Descendants(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, string? culture = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| INavigationQueryService | navigationQueryService | The navigation query service. |
| IPublishedStatusFilteringService | publishedStatusFilteringService | The published status filtering service. |
| string | culture | The culture for variant content. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IPublishedContent> | An enumerable of all descendant content items. |
DescendantsOfType(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService, string, string?)
Gets all descendants of the content item of a specific content type.
Declaration
public static IEnumerable<IPublishedContent> DescendantsOfType(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, string contentTypeAlias, string? culture = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| INavigationQueryService | navigationQueryService | The navigation query service. |
| IPublishedStatusFilteringService | publishedStatusFilteringService | The published status filtering service. |
| string | contentTypeAlias | The content type alias to filter by. |
| string | culture | The culture for variant content. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IPublishedContent> | An enumerable of descendant content items of the specified type. |
DescendantsOrSelf(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService, int, string?)
Gets all descendants of the content item including itself at or above a specified level.
Declaration
public static IEnumerable<IPublishedContent> DescendantsOrSelf(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, int level, string? culture = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| INavigationQueryService | navigationQueryService | The navigation query service. |
| IPublishedStatusFilteringService | publishedStatusFilteringService | The published status filtering service. |
| int | level | The minimum level to return. |
| string | culture | The culture for variant content. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IPublishedContent> | An enumerable of the content item and all its descendants at or above the level. |
DescendantsOrSelf(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService, string?)
Gets all descendants of the content item including itself.
Declaration
public static IEnumerable<IPublishedContent> DescendantsOrSelf(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, string? culture = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| INavigationQueryService | navigationQueryService | The navigation query service. |
| IPublishedStatusFilteringService | publishedStatusFilteringService | The published status filtering service. |
| string | culture | The culture for variant content. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IPublishedContent> | An enumerable of the content item and all its descendants. |
DescendantsOrSelfOfType(IEnumerable<IPublishedContent>, INavigationQueryService, IPublishedStatusFilteringService, string, string?)
Gets all descendants or self of a collection of content items of a specific content type.
Declaration
public static IEnumerable<IPublishedContent> DescendantsOrSelfOfType(this IEnumerable<IPublishedContent> parentNodes, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, string docTypeAlias, string? culture = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<IPublishedContent> | parentNodes | The collection of parent content items. |
| INavigationQueryService | navigationQueryService | The navigation query service. |
| IPublishedStatusFilteringService | publishedStatusFilteringService | The published status filtering service. |
| string | docTypeAlias | The content type alias to filter by. |
| string | culture | The culture for variant content. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IPublishedContent> | An enumerable of all content items and their descendants of the specified type. |
DescendantsOrSelfOfType(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService, string, string?)
Gets all descendants of the content item including itself of a specific content type.
Declaration
public static IEnumerable<IPublishedContent> DescendantsOrSelfOfType(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, string contentTypeAlias, string? culture = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| INavigationQueryService | navigationQueryService | The navigation query service. |
| IPublishedStatusFilteringService | publishedStatusFilteringService | The published status filtering service. |
| string | contentTypeAlias | The content type alias to filter by. |
| string | culture | The culture for variant content. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IPublishedContent> | An enumerable of the content item and its descendants of the specified type. |
DescendantsOrSelf<T>(IEnumerable<IPublishedContent>, INavigationQueryService, IPublishedStatusFilteringService, string?)
Gets all descendants or self of a collection of content items of a specific type.
Declaration
public static IEnumerable<T> DescendantsOrSelf<T>(this IEnumerable<IPublishedContent> parentNodes, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, string? culture = null) where T : class, IPublishedContent
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<IPublishedContent> | parentNodes | The collection of parent content items. |
| INavigationQueryService | navigationQueryService | The navigation query service. |
| IPublishedStatusFilteringService | publishedStatusFilteringService | The published status filtering service. |
| string | culture | The culture for variant content. |
Returns
| Type | Description |
|---|---|
| IEnumerable<T> | An enumerable of all content items and their descendants of the specified type. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of content to return. |
DescendantsOrSelf<T>(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService, int, string?)
Gets all descendants of the content item including itself of a specific type at or above a specified level.
Declaration
public static IEnumerable<T> DescendantsOrSelf<T>(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, int level, string? culture = null) where T : class, IPublishedContent
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| INavigationQueryService | navigationQueryService | The navigation query service. |
| IPublishedStatusFilteringService | publishedStatusFilteringService | The published status filtering service. |
| int | level | The minimum level to return. |
| string | culture | The culture for variant content. |
Returns
| Type | Description |
|---|---|
| IEnumerable<T> | An enumerable of the content item and its descendants of the specified type at or above the level. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of content to return. |
DescendantsOrSelf<T>(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService, string?)
Gets all descendants of the content item including itself of a specific type.
Declaration
public static IEnumerable<T> DescendantsOrSelf<T>(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, string? culture = null) where T : class, IPublishedContent
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| INavigationQueryService | navigationQueryService | The navigation query service. |
| IPublishedStatusFilteringService | publishedStatusFilteringService | The published status filtering service. |
| string | culture | The culture for variant content. |
Returns
| Type | Description |
|---|---|
| IEnumerable<T> | An enumerable of the content item and its descendants of the specified type. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of content to return. |
Descendants<T>(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService, int, string?)
Gets all descendants of the content item of a specific type at or above a specified level.
Declaration
public static IEnumerable<T> Descendants<T>(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, int level, string? culture = null) where T : class, IPublishedContent
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| INavigationQueryService | navigationQueryService | The navigation query service. |
| IPublishedStatusFilteringService | publishedStatusFilteringService | The published status filtering service. |
| int | level | The minimum level of descendants to return. |
| string | culture | The culture for variant content. |
Returns
| Type | Description |
|---|---|
| IEnumerable<T> | An enumerable of descendant content items of the specified type at or above the level. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of content to return. |
Descendants<T>(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService, string?)
Gets all descendants of the content item of a specific type.
Declaration
public static IEnumerable<T> Descendants<T>(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, string? culture = null) where T : class, IPublishedContent
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| INavigationQueryService | navigationQueryService | The navigation query service. |
| IPublishedStatusFilteringService | publishedStatusFilteringService | The published status filtering service. |
| string | culture | The culture for variant content. |
Returns
| Type | Description |
|---|---|
| IEnumerable<T> | An enumerable of descendant content items of the specified type. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of content to return. |
FirstChild(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService, Func<IPublishedContent, bool>, string?)
Gets the first child of the content item that matches a predicate.
Declaration
public static IPublishedContent? FirstChild(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, Func<IPublishedContent, bool> predicate, string? culture = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| INavigationQueryService | navigationQueryService | The navigation query service. |
| IPublishedStatusFilteringService | publishedStatusFilteringService | The published status filtering service. |
| Func<IPublishedContent, bool> | predicate | The predicate to filter children. |
| string | culture | The culture for variant content. |
Returns
| Type | Description |
|---|---|
| IPublishedContent | The first child matching the predicate, or null if none exists. |
FirstChild(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService, Guid, string?)
Gets the first child of the content item with a specific unique identifier.
Declaration
public static IPublishedContent? FirstChild(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, Guid uniqueId, string? culture = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| INavigationQueryService | navigationQueryService | The navigation query service. |
| IPublishedStatusFilteringService | publishedStatusFilteringService | The published status filtering service. |
| Guid | uniqueId | The unique identifier of the child to find. |
| string | culture | The culture for variant content. |
Returns
| Type | Description |
|---|---|
| IPublishedContent | The first child with the specified unique identifier, or null if none exists. |
FirstChild(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService, string?)
Gets the first child of the content item.
Declaration
public static IPublishedContent? FirstChild(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, string? culture = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| INavigationQueryService | navigationQueryService | The navigation query service. |
| IPublishedStatusFilteringService | publishedStatusFilteringService | The published status filtering service. |
| string | culture | The culture for variant content. |
Returns
| Type | Description |
|---|---|
| IPublishedContent | The first child, or null if no children exist. |
FirstChildOfType(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService, string, string?)
Gets the first child of the content, of a given content type.
Declaration
public static IPublishedContent? FirstChildOfType(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, string contentTypeAlias, string? culture = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | |
| INavigationQueryService | navigationQueryService | |
| IPublishedStatusFilteringService | publishedStatusFilteringService | |
| string | contentTypeAlias | |
| string | culture |
Returns
| Type | Description |
|---|---|
| IPublishedContent |
FirstChild<T>(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService, Func<T, bool>, string?)
Gets the first child of the content item of a specific type that matches a predicate.
Declaration
public static T? FirstChild<T>(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, Func<T, bool> predicate, string? culture = null) where T : class, IPublishedContent
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| INavigationQueryService | navigationQueryService | The navigation query service. |
| IPublishedStatusFilteringService | publishedStatusFilteringService | The published status filtering service. |
| Func<T, bool> | predicate | The predicate to filter children. |
| string | culture | The culture for variant content. |
Returns
| Type | Description |
|---|---|
| T | The first child of the specified type matching the predicate, or null if none exists. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of content to return. |
FirstChild<T>(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService, string?)
Gets the first child of the content item of a specific type.
Declaration
public static T? FirstChild<T>(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, string? culture = null) where T : class, IPublishedContent
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| INavigationQueryService | navigationQueryService | The navigation query service. |
| IPublishedStatusFilteringService | publishedStatusFilteringService | The published status filtering service. |
| string | culture | The culture for variant content. |
Returns
| Type | Description |
|---|---|
| T | The first child of the specified type, or null if none exists. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of content to return. |
GetCreatorName(IPublishedContent, IUserService)
Gets the name of the user who created the content item.
Declaration
public static string GetCreatorName(this IPublishedContent content, IUserService userService)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| IUserService | userService | The user service. |
Returns
| Type | Description |
|---|---|
| string | The name of the creator, or an empty string if not found. |
GetCultureFromDomains(IPublishedContent, IUmbracoContextAccessor, ISiteDomainMapper, IDomainCache, INavigationQueryService, IPublishedStatusFilteringService, Uri?)
Gets the culture assigned to a document by domains, in the context of a current Uri.
Declaration
public static string? GetCultureFromDomains(this IPublishedContent content, IUmbracoContextAccessor umbracoContextAccessor, ISiteDomainMapper siteDomainHelper, IDomainCache domainCache, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, Uri? current = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The document. |
| IUmbracoContextAccessor | umbracoContextAccessor | |
| ISiteDomainMapper | siteDomainHelper | The site domain helper. |
| IDomainCache | domainCache | The domain cache. |
| INavigationQueryService | navigationQueryService | The navigation query service. |
| IPublishedStatusFilteringService | publishedStatusFilteringService | The published status filtering service. |
| Uri | current | An optional current Uri. |
Returns
| Type | Description |
|---|---|
| string | The culture assigned to the document by domains. |
Remarks
In 1:1 multilingual setup, a document contains several cultures (there is not one document per culture), and domains, withing the context of a current Uri, assign a culture to that document.
GetTemplateAlias(IPublishedContent, IFileService)
Returns the current template Alias
Declaration
public static string GetTemplateAlias(this IPublishedContent content, IFileService fileService)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | |
| IFileService | fileService |
Returns
| Type | Description |
|---|---|
| string | Empty string if none is set. |
GetWriterName(IPublishedContent, IUserService)
Gets the name of the user who last updated the content item.
Declaration
public static string GetWriterName(this IPublishedContent content, IUserService userService)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| IUserService | userService | The user service. |
Returns
| Type | Description |
|---|---|
| string | The name of the writer, or an empty string if not found. |
HasCulture(IPublishedContent, string?)
Determines whether the content has a culture.
Declaration
public static bool HasCulture(this IPublishedContent content, string? culture)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | |
| string | culture |
Returns
| Type | Description |
|---|---|
| bool |
Remarks
Culture is case-insensitive.
HasValue(IPublishedContent, IPublishedValueFallback, string, string?, string?, Fallback)
Gets a value indicating whether the content has a value for a property identified by its alias.
Declaration
public static bool HasValue(this IPublishedContent content, IPublishedValueFallback publishedValueFallback, string alias, string? culture = null, string? segment = null, Fallback fallback = default)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content. |
| IPublishedValueFallback | publishedValueFallback | The published value fallback implementation. |
| string | alias | The property alias. |
| string | culture | The variation language. |
| string | segment | The variation segment. |
| Fallback | fallback | Optional fallback strategy. |
Returns
| Type | Description |
|---|---|
| bool | A value indicating whether the content has a value for the property identified by the alias. |
Remarks
Returns true if HasValue is true, or a fallback strategy can provide a value.
IsAllowedTemplate(IPublishedContent, IContentTypeService, bool, bool, int)
Determines whether a specific template is allowed for the content item.
Declaration
public static bool IsAllowedTemplate(this IPublishedContent content, IContentTypeService contentTypeService, bool disableAlternativeTemplates, bool validateAlternativeTemplates, int templateId)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| IContentTypeService | contentTypeService | The content type service. |
| bool | disableAlternativeTemplates | Whether alternative templates are disabled. |
| bool | validateAlternativeTemplates | Whether to validate alternative templates against allowed templates. |
| int | templateId | The template identifier. |
Returns
| Type | Description |
|---|---|
| bool |
|
IsAllowedTemplate(IPublishedContent, IContentTypeService, WebRoutingSettings, int)
Determines whether a specific template is allowed for the content item.
Declaration
public static bool IsAllowedTemplate(this IPublishedContent content, IContentTypeService contentTypeService, WebRoutingSettings webRoutingSettings, int templateId)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| IContentTypeService | contentTypeService | The content type service. |
| WebRoutingSettings | webRoutingSettings | The web routing settings. |
| int | templateId | The template identifier. |
Returns
| Type | Description |
|---|---|
| bool |
|
IsAllowedTemplate(IPublishedContent, IFileService, IContentTypeService, bool, bool, string)
Determines whether a specific template is allowed for the content item by template alias.
Declaration
public static bool IsAllowedTemplate(this IPublishedContent content, IFileService fileService, IContentTypeService contentTypeService, bool disableAlternativeTemplates, bool validateAlternativeTemplates, string templateAlias)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| IFileService | fileService | The file service. |
| IContentTypeService | contentTypeService | The content type service. |
| bool | disableAlternativeTemplates | Whether alternative templates are disabled. |
| bool | validateAlternativeTemplates | Whether to validate alternative templates against allowed templates. |
| string | templateAlias | The template alias. |
Returns
| Type | Description |
|---|---|
| bool |
|
IsAncestor(IPublishedContent, IPublishedContent)
Determines whether this content item is an ancestor of another content item.
Declaration
public static bool IsAncestor(this IPublishedContent content, IPublishedContent other)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| IPublishedContent | other | The potential descendant content item. |
Returns
| Type | Description |
|---|---|
| bool |
|
IsAncestor(IPublishedContent, IPublishedContent, string)
Declaration
public static IHtmlContent IsAncestor(this IPublishedContent content, IPublishedContent other, string valueIfTrue)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | |
| IPublishedContent | other | |
| string | valueIfTrue |
Returns
| Type | Description |
|---|---|
| IHtmlContent |
IsAncestor(IPublishedContent, IPublishedContent, string, string)
If the specified content is an ancestor of other, the HTML encoded
valueIfTrue will be returned; otherwise, valueIfFalse.
Declaration
public static IHtmlContent IsAncestor(this IPublishedContent content, IPublishedContent other, string valueIfTrue, string valueIfFalse)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content. |
| IPublishedContent | other | The other content. |
| string | valueIfTrue | The value if |
| string | valueIfFalse | The value if |
Returns
| Type | Description |
|---|---|
| IHtmlContent | The HTML encoded value. |
IsAncestorOrSelf(IPublishedContent, IPublishedContent)
Determines whether this content item is an ancestor of or the same as another content item.
Declaration
public static bool IsAncestorOrSelf(this IPublishedContent content, IPublishedContent other)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| IPublishedContent | other | The potential descendant or same content item. |
Returns
| Type | Description |
|---|---|
| bool |
|
IsAncestorOrSelf(IPublishedContent, IPublishedContent, string)
Declaration
public static IHtmlContent IsAncestorOrSelf(this IPublishedContent content, IPublishedContent other, string valueIfTrue)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | |
| IPublishedContent | other | |
| string | valueIfTrue |
Returns
| Type | Description |
|---|---|
| IHtmlContent |
IsAncestorOrSelf(IPublishedContent, IPublishedContent, string, string)
If the specified content is an ancestor of other or are the same, the HTML
encoded valueIfTrue will be returned; otherwise, valueIfFalse.
Declaration
public static IHtmlContent IsAncestorOrSelf(this IPublishedContent content, IPublishedContent other, string valueIfTrue, string valueIfFalse)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content. |
| IPublishedContent | other | The other content. |
| string | valueIfTrue | The value if |
| string | valueIfFalse | The value if |
Returns
| Type | Description |
|---|---|
| IHtmlContent | The HTML encoded value. |
IsComposedOf(IPublishedContent, string)
Gets a value indicating whether the content is of a content type composed of the given alias
Declaration
public static bool IsComposedOf(this IPublishedContent content, string alias)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content. |
| string | alias | The content type alias. |
Returns
| Type | Description |
|---|---|
| bool | A value indicating whether the content is of a content type composed of a content type identified by the alias. |
IsDescendant(IPublishedContent, IPublishedContent)
Determines whether this content item is a descendant of another content item.
Declaration
public static bool IsDescendant(this IPublishedContent content, IPublishedContent other)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| IPublishedContent | other | The potential ancestor content item. |
Returns
| Type | Description |
|---|---|
| bool |
|
IsDescendant(IPublishedContent, IPublishedContent, string)
If the specified content is a decendant of other, the HTML encoded
valueIfTrue will be returned; otherwise, string.Empty.
Declaration
public static IHtmlContent IsDescendant(this IPublishedContent content, IPublishedContent other, string valueIfTrue)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content. |
| IPublishedContent | other | The other content. |
| string | valueIfTrue | The value if |
Returns
| Type | Description |
|---|---|
| IHtmlContent | The HTML encoded value. |
IsDescendant(IPublishedContent, IPublishedContent, string, string)
If the specified content is a decendant of other, the HTML encoded
valueIfTrue will be returned; otherwise, valueIfFalse.
Declaration
public static IHtmlContent IsDescendant(this IPublishedContent content, IPublishedContent other, string valueIfTrue, string valueIfFalse)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content. |
| IPublishedContent | other | The other content. |
| string | valueIfTrue | The value if |
| string | valueIfFalse | The value if |
Returns
| Type | Description |
|---|---|
| IHtmlContent | The HTML encoded value. |
IsDescendantOrSelf(IPublishedContent, IPublishedContent)
Determines whether this content item is a descendant of or the same as another content item.
Declaration
public static bool IsDescendantOrSelf(this IPublishedContent content, IPublishedContent other)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| IPublishedContent | other | The potential ancestor or same content item. |
Returns
| Type | Description |
|---|---|
| bool |
|
IsDescendantOrSelf(IPublishedContent, IPublishedContent, string)
Declaration
public static IHtmlContent IsDescendantOrSelf(this IPublishedContent content, IPublishedContent other, string valueIfTrue)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | |
| IPublishedContent | other | |
| string | valueIfTrue |
Returns
| Type | Description |
|---|---|
| IHtmlContent |
IsDescendantOrSelf(IPublishedContent, IPublishedContent, string, string)
If the specified content is a decendant of other or are the same, the HTML
encoded valueIfTrue will be returned; otherwise, valueIfFalse.
Declaration
public static IHtmlContent IsDescendantOrSelf(this IPublishedContent content, IPublishedContent other, string valueIfTrue, string valueIfFalse)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content. |
| IPublishedContent | other | The other content. |
| string | valueIfTrue | The value if |
| string | valueIfFalse | The value if |
Returns
| Type | Description |
|---|---|
| IHtmlContent | The HTML encoded value. |
IsDocumentType(IPublishedContent, string)
Determines whether the specified content is a specified content type.
Declaration
public static bool IsDocumentType(this IPublishedContent content, string docTypeAlias)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content to determine content type of. |
| string | docTypeAlias | The alias of the content type to test against. |
Returns
| Type | Description |
|---|---|
| bool | True if the content is of the specified content type; otherwise false. |
IsDocumentType(IPublishedContent, string, bool)
Determines whether the specified content is a specified content type or it's derived types.
Declaration
public static bool IsDocumentType(this IPublishedContent content, string docTypeAlias, bool recursive)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content to determine content type of. |
| string | docTypeAlias | The alias of the content type to test against. |
| bool | recursive | When true, recurses up the content type tree to check inheritance; when false just calls IsDocumentType(this IPublishedContent content, string docTypeAlias). |
Returns
| Type | Description |
|---|---|
| bool | True if the content is of the specified content type or a derived content type; otherwise false. |
IsEqual(IPublishedContent, IPublishedContent)
Determines whether this content item is equal to another content item by comparing their IDs.
Declaration
public static bool IsEqual(this IPublishedContent content, IPublishedContent other)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| IPublishedContent | other | The other content item to compare. |
Returns
| Type | Description |
|---|---|
| bool |
|
IsEqual(IPublishedContent, IPublishedContent, string)
If the specified content is equal to other, the HTML encoded
valueIfTrue will be returned; otherwise, string.Empty.
Declaration
public static IHtmlContent IsEqual(this IPublishedContent content, IPublishedContent other, string valueIfTrue)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content. |
| IPublishedContent | other | The other content. |
| string | valueIfTrue | The value if |
Returns
| Type | Description |
|---|---|
| IHtmlContent | The HTML encoded value. |
IsEqual(IPublishedContent, IPublishedContent, string, string)
If the specified content is equal to other, the HTML encoded
valueIfTrue will be returned; otherwise, valueIfFalse.
Declaration
public static IHtmlContent IsEqual(this IPublishedContent content, IPublishedContent other, string valueIfTrue, string valueIfFalse)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content. |
| IPublishedContent | other | The other content. |
| string | valueIfTrue | The value if |
| string | valueIfFalse | The value if |
Returns
| Type | Description |
|---|---|
| IHtmlContent | The HTML encoded value. |
IsInvariantOrHasCulture(IPublishedContent, string)
Determines whether the content is invariant, or has a culture.
Declaration
public static bool IsInvariantOrHasCulture(this IPublishedContent content, string culture)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | |
| string | culture |
Returns
| Type | Description |
|---|---|
| bool |
Remarks
Culture is case-insensitive.
IsNotEqual(IPublishedContent, IPublishedContent)
Determines whether this content item is not equal to another content item by comparing their IDs.
Declaration
public static bool IsNotEqual(this IPublishedContent content, IPublishedContent other)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| IPublishedContent | other | The other content item to compare. |
Returns
| Type | Description |
|---|---|
| bool |
|
IsNotEqual(IPublishedContent, IPublishedContent, string)
If the specified content is not equal to other, the HTML encoded
valueIfTrue will be returned; otherwise, string.Empty.
Declaration
public static IHtmlContent IsNotEqual(this IPublishedContent content, IPublishedContent other, string valueIfTrue)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content. |
| IPublishedContent | other | The other content. |
| string | valueIfTrue | The value if |
Returns
| Type | Description |
|---|---|
| IHtmlContent | The HTML encoded value. |
IsNotEqual(IPublishedContent, IPublishedContent, string, string)
If the specified content is not equal to other, the HTML encoded
valueIfTrue will be returned; otherwise, valueIfFalse.
Declaration
public static IHtmlContent IsNotEqual(this IPublishedContent content, IPublishedContent other, string valueIfTrue, string valueIfFalse)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content. |
| IPublishedContent | other | The other content. |
| string | valueIfTrue | The value if |
| string | valueIfFalse | The value if |
Returns
| Type | Description |
|---|---|
| IHtmlContent | The HTML encoded value. |
Name(IPublishedContent, IVariationContextAccessor?, string?)
Gets the name of the content item.
Declaration
public static string Name(this IPublishedContent content, IVariationContextAccessor? variationContextAccessor, string? culture = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| IVariationContextAccessor | variationContextAccessor | |
| string | culture | The specific culture to get the name for. If null is used the current culture is used (Default is null). |
Returns
| Type | Description |
|---|---|
| string |
Parent<T>(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService)
Gets the parent of the content, of a given content type.
Declaration
public static T? Parent<T>(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService) where T : class, IPublishedContent
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content. |
| INavigationQueryService | navigationQueryService | The query service for the in-memory navigation structure. |
| IPublishedStatusFilteringService | publishedStatusFilteringService |
Returns
| Type | Description |
|---|---|
| T | The parent of content, of the given content type, else null. |
Type Parameters
| Name | Description |
|---|---|
| T | The content type. |
Root(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService)
Gets the root content (ancestor or self at level 1) for the specified content.
Declaration
public static IPublishedContent Root(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content. |
| INavigationQueryService | navigationQueryService | The query service for the in-memory navigation structure. |
| IPublishedStatusFilteringService | publishedStatusFilteringService |
Returns
| Type | Description |
|---|---|
| IPublishedContent | The root content (ancestor or self at level 1) for the specified |
Remarks
This is the same as calling
AncestorOrSelf(IPublishedContent, int) with maxLevel
set to 1.
Root<T>(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService)
Gets the root content (ancestor or self at level 1) for the specified content if it's of the
specified content type T.
Declaration
public static T? Root<T>(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService) where T : class, IPublishedContent
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content. |
| INavigationQueryService | navigationQueryService | The query service for the in-memory navigation structure. |
| IPublishedStatusFilteringService | publishedStatusFilteringService |
Returns
| Type | Description |
|---|---|
| T | The root content (ancestor or self at level 1) for the specified |
Type Parameters
| Name | Description |
|---|---|
| T | The content type. |
Remarks
This is the same as calling
AncestorOrSelf<T>(IPublishedContent, int) with
maxLevel set to 1.
SearchChildren(IPublishedContent, IExamineManager, IUmbracoContextAccessor, string, string?)
Declaration
public static IEnumerable<PublishedSearchResult> SearchChildren(this IPublishedContent content, IExamineManager examineManager, IUmbracoContextAccessor umbracoContextAccessor, string term, string? indexName = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | |
| IExamineManager | examineManager | |
| IUmbracoContextAccessor | umbracoContextAccessor | |
| string | term | |
| string | indexName |
Returns
| Type | Description |
|---|---|
| IEnumerable<PublishedSearchResult> |
SearchDescendants(IPublishedContent, IExamineManager, IUmbracoContextAccessor, string, string?)
Declaration
public static IEnumerable<PublishedSearchResult> SearchDescendants(this IPublishedContent content, IExamineManager examineManager, IUmbracoContextAccessor umbracoContextAccessor, string term, string? indexName = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | |
| IExamineManager | examineManager | |
| IUmbracoContextAccessor | umbracoContextAccessor | |
| string | term | |
| string | indexName |
Returns
| Type | Description |
|---|---|
| IEnumerable<PublishedSearchResult> |
Siblings(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService, string?)
Gets the siblings of the content.
Declaration
public static IEnumerable<IPublishedContent> Siblings(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, string? culture = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content. |
| INavigationQueryService | navigationQueryService | The navigation service |
| IPublishedStatusFilteringService | publishedStatusFilteringService | |
| string | culture | The specific culture to filter for. If null is used the current culture is used. (Default is null) |
Returns
| Type | Description |
|---|---|
| IEnumerable<IPublishedContent> | The siblings of the content. |
Remarks
Note that in V7 this method also return the content node self.
SiblingsAndSelf(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService, string?)
Gets the siblings of the content including the node itself to indicate the position.
Declaration
public static IEnumerable<IPublishedContent> SiblingsAndSelf(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, string? culture = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content. |
| INavigationQueryService | navigationQueryService | The navigation service. |
| IPublishedStatusFilteringService | publishedStatusFilteringService | |
| string | culture | The specific culture to filter for. If null is used the current culture is used. (Default is null) |
Returns
| Type | Description |
|---|---|
| IEnumerable<IPublishedContent> | The siblings of the content including the node itself. |
SiblingsAndSelfOfType(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService, string, string?)
Gets the siblings of the content including the node itself to indicate the position, of a given content type.
Declaration
public static IEnumerable<IPublishedContent> SiblingsAndSelfOfType(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, string contentTypeAlias, string? culture = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content. |
| INavigationQueryService | navigationQueryService | |
| IPublishedStatusFilteringService | publishedStatusFilteringService | |
| string | contentTypeAlias | The content type alias. |
| string | culture | The specific culture to filter for. If null is used the current culture is used. (Default is null) |
Returns
| Type | Description |
|---|---|
| IEnumerable<IPublishedContent> | The siblings of the content including the node itself, of the given content type. |
SiblingsAndSelf<T>(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService, string?)
Gets the siblings of the content including the node itself to indicate the position, of a given content type.
Declaration
public static IEnumerable<T> SiblingsAndSelf<T>(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, string? culture = null) where T : class, IPublishedContent
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content. |
| INavigationQueryService | navigationQueryService | |
| IPublishedStatusFilteringService | publishedStatusFilteringService | |
| string | culture | The specific culture to filter for. If null is used the current culture is used. (Default is null) |
Returns
| Type | Description |
|---|---|
| IEnumerable<T> | The siblings of the content including the node itself, of the given content type. |
Type Parameters
| Name | Description |
|---|---|
| T | The content type. |
SiblingsOfType(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService, string, string?)
Gets the siblings of the content, of a given content type.
Declaration
public static IEnumerable<IPublishedContent> SiblingsOfType(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, string contentTypeAlias, string? culture = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content. |
| INavigationQueryService | navigationQueryService | |
| IPublishedStatusFilteringService | publishedStatusFilteringService | |
| string | contentTypeAlias | The content type alias. |
| string | culture | The specific culture to filter for. If null is used the current culture is used. (Default is null) |
Returns
| Type | Description |
|---|---|
| IEnumerable<IPublishedContent> | The siblings of the content, of the given content type. |
Remarks
Note that in V7 this method also return the content node self.
Siblings<T>(IPublishedContent, INavigationQueryService, IPublishedStatusFilteringService, string?)
Gets the siblings of the content, of a given content type.
Declaration
public static IEnumerable<T> Siblings<T>(this IPublishedContent content, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, string? culture = null) where T : class, IPublishedContent
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content. |
| INavigationQueryService | navigationQueryService | |
| IPublishedStatusFilteringService | publishedStatusFilteringService | |
| string | culture | The specific culture to filter for. If null is used the current culture is used. (Default is null) |
Returns
| Type | Description |
|---|---|
| IEnumerable<T> | The siblings of the content, of the given content type. |
Type Parameters
| Name | Description |
|---|---|
| T | The content type. |
Remarks
Note that in V7 this method also return the content node self.
Url(IPublishedContent, IPublishedUrlProvider, string?, UrlMode)
Gets the url of the content item.
Declaration
public static string Url(this IPublishedContent content, IPublishedUrlProvider publishedUrlProvider, string? culture = null, UrlMode mode = UrlMode.Default)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | |
| IPublishedUrlProvider | publishedUrlProvider | |
| string | culture | |
| UrlMode | mode |
Returns
| Type | Description |
|---|---|
| string |
Remarks
If the content item is a document, then this method returns the url of the document. If it is a media, then this methods return the media url for the 'umbracoFile' property. Use the MediaUrl() method to get the media url for other properties.
The value of this property is contextual. It depends on the 'current' request uri, if any. In addition, when the content type is multi-lingual, this is the url for the specified culture. Otherwise, it is the invariant url.
UrlSegment(IPublishedContent, IVariationContextAccessor?, string?)
Gets the URL segment of the content item.
Declaration
[Obsolete("Please use GetUrlSegment() on IDocumentUrlService instead. Scheduled for removal in Umbraco 18.")]
public static string? UrlSegment(this IPublishedContent content, IVariationContextAccessor? variationContextAccessor, string? culture = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| IVariationContextAccessor | variationContextAccessor | |
| string | culture | The specific culture to get the URL segment for. If null is used the current culture is used (Default is null). |
Returns
| Type | Description |
|---|---|
| string |
Value(IPublishedContent, IPublishedValueFallback, string, string?, string?, Fallback, object?)
Gets the value of a content's property identified by its alias, if it exists, otherwise a default value.
Declaration
public static object? Value(this IPublishedContent content, IPublishedValueFallback publishedValueFallback, string alias, string? culture = null, string? segment = null, Fallback fallback = default, object? defaultValue = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content. |
| IPublishedValueFallback | publishedValueFallback | The published value fallback implementation. |
| string | alias | The property alias. |
| string | culture | The variation language. |
| string | segment | The variation segment. |
| Fallback | fallback | Optional fallback strategy. |
| object | defaultValue | The default value. |
Returns
| Type | Description |
|---|---|
| object | The value of the content's property identified by the alias, if it exists, otherwise a default value. |
Value<T>(IPublishedContent, IPublishedValueFallback, string, string?, string?, Fallback, T?)
Gets the value of a content's property identified by its alias, converted to a specified type.
Declaration
public static T? Value<T>(this IPublishedContent content, IPublishedValueFallback publishedValueFallback, string alias, string? culture = null, string? segment = null, Fallback fallback = default, T? defaultValue = default)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content. |
| IPublishedValueFallback | publishedValueFallback | The published value fallback implementation. |
| string | alias | The property alias. |
| string | culture | The variation language. |
| string | segment | The variation segment. |
| Fallback | fallback | Optional fallback strategy. |
| T | defaultValue | The default value. |
Returns
| Type | Description |
|---|---|
| T | The value of the content's property identified by the alias, converted to the specified type. |
Type Parameters
| Name | Description |
|---|---|
| T | The target property type. |
WriterName(IPublishedContent, IUserService)
Gets the name of the content item writer.
Declaration
public static string? WriterName(this IPublishedContent content, IUserService userService)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The content item. |
| IUserService | userService |
Returns
| Type | Description |
|---|---|
| string |