Class PublishedContentExtensions
Inheritance
Namespace: Umbraco.Core
Assembly: Umbraco.Core.dll
Syntax
public static class PublishedContentExtensions
Methods
View SourceChildren(IPublishedContent, String)
Gets the children of the content item.
Declaration
public static IEnumerable<IPublishedContent> Children(this IPublishedContent content, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content item. |
System.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 |
---|---|
System.Collections.Generic.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.
CultureDate(IPublishedContent, String)
Gets the culture date of the content item.
Declaration
public static DateTime CultureDate(this IPublishedContent content, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content item. |
System.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 |
---|---|
System.DateTime |
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 | |
System.String | culture |
Returns
Type | Description |
---|---|
System.Boolean |
Remarks
Culture is case-insensitive.
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 | |
System.String | culture |
Returns
Type | Description |
---|---|
System.Boolean |
Remarks
Culture is case-insensitive.
Name(IPublishedContent, String)
Gets the name of the content item.
Declaration
public static string Name(this IPublishedContent content, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content item. |
System.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 |
---|---|
System.String |
UrlSegment(IPublishedContent, String)
Gets the URL segment of the content item.
Declaration
public static string UrlSegment(this IPublishedContent content, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content item. |
System.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 |
---|---|
System.String |