Class PublishedContentExtensions
Inheritance
Namespace: Umbraco.Extensions
Assembly: Umbraco.Core.dll
Syntax
public static class PublishedContentExtensions
Methods
View SourceAncestor(IPublishedContent)
Gets the ancestor of the content, ie its parent.
Declaration
public static IPublishedContent Ancestor(this IPublishedContent content)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content. |
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, Int32)
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, int maxLevel)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content. |
System.Int32 | 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, String)
Gets the nearest ancestor of the content, of a specified content type.
Declaration
public static IPublishedContent Ancestor(this IPublishedContent content, string contentTypeAlias)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content. |
System.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
.
Ancestor<T>(IPublishedContent)
Gets the nearest ancestor of the content, of a specified content type.
Declaration
public static T Ancestor<T>(this IPublishedContent content)
where T : class, IPublishedContent
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content. |
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, Int32)
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, int maxLevel)
where T : class, IPublishedContent
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content. |
System.Int32 | 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
.
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, Int32)
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, int maxLevel)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content. |
System.Int32 | 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, String)
Gets the content or its nearest ancestor, of a specified content type.
Declaration
public static IPublishedContent AncestorOrSelf(this IPublishedContent content, string contentTypeAlias)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content. |
System.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)
Gets the content or its nearest ancestor, of a specified content type.
Declaration
public static T AncestorOrSelf<T>(this IPublishedContent content)
where T : class, IPublishedContent
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content. |
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, Int32)
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, int maxLevel)
where T : class, IPublishedContent
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content. |
System.Int32 | maxLevel | The level. |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T | The content type. |
Ancestors(IPublishedContent)
Gets the ancestors of the content.
Declaration
public static IEnumerable<IPublishedContent> Ancestors(this IPublishedContent content)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content. |
Returns
Type | Description |
---|---|
IEnumerable<IPublishedContent> | The ancestors of the content, in down-top order. |
Remarks
Does not consider the content itself.
Ancestors(IPublishedContent, Int32)
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, int maxLevel)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content. |
System.Int32 | 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, String)
Gets the ancestors of the content, of a specified content type.
Declaration
public static IEnumerable<IPublishedContent> Ancestors(this IPublishedContent content, string contentTypeAlias)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content. |
System.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.
Ancestors<T>(IPublishedContent)
Gets the ancestors of the content, of a specified content type.
Declaration
public static IEnumerable<T> Ancestors<T>(this IPublishedContent content)
where T : class, IPublishedContent
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content. |
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, Int32)
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, int maxLevel)
where T : class, IPublishedContent
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content. |
System.Int32 | 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.
AncestorsOrSelf(IPublishedContent)
Gets the content and its ancestors.
Declaration
public static IEnumerable<IPublishedContent> AncestorsOrSelf(this IPublishedContent content)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content. |
Returns
Type | Description |
---|---|
IEnumerable<IPublishedContent> | The content and its ancestors, in down-top order. |
AncestorsOrSelf(IPublishedContent, Boolean, Nullable<Func<IPublishedContent, Boolean>>)
Declaration
public static IEnumerable<IPublishedContent> AncestorsOrSelf(this IPublishedContent content, bool orSelf, Func<IPublishedContent, bool>? func)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
System.Boolean | orSelf | |
System.Nullable<Func<IPublishedContent, System.Boolean>> | func |
Returns
Type | Description |
---|---|
IEnumerable<IPublishedContent> |
AncestorsOrSelf(IPublishedContent, Int32)
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, int maxLevel)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content. |
System.Int32 | 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, String)
Gets the content and its ancestors, of a specified content type.
Declaration
public static IEnumerable<IPublishedContent> AncestorsOrSelf(this IPublishedContent content, string contentTypeAlias)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content. |
System.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)
Gets the content and its ancestors, of a specified content type.
Declaration
public static IEnumerable<T> AncestorsOrSelf<T>(this IPublishedContent content)
where T : class, IPublishedContent
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content. |
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, Int32)
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, int maxLevel)
where T : class, IPublishedContent
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content. |
System.Int32 | 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.
Breadcrumbs(IPublishedContent, Boolean)
Gets the breadcrumbs (ancestors and self, top to bottom) for the specified content
.
Declaration
public static IEnumerable<IPublishedContent> Breadcrumbs(this IPublishedContent content, bool andSelf = true)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content. |
System.Boolean | 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, Int32, Boolean)
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, int minLevel, bool andSelf = true)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content. |
System.Int32 | minLevel | The minimum level. |
System.Boolean | 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, Boolean)
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, bool andSelf = true)
where T : class, IPublishedContent
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content. |
System.Boolean | 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, IVariationContextAccessor, Func<IPublishedContent, Boolean>, String)
Gets the children of the content, filtered by a predicate.
Declaration
public static IEnumerable<IPublishedContent> Children(this IPublishedContent content, IVariationContextAccessor variationContextAccessor, Func<IPublishedContent, bool> predicate, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content. |
IVariationContextAccessor | variationContextAccessor | The accessor for VariationContext |
Func<IPublishedContent, System.Boolean> | predicate | The predicate. |
System.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, IVariationContextAccessor, String)
Gets the children of the content item.
Declaration
public static IEnumerable<IPublishedContent> Children(this IPublishedContent content, IVariationContextAccessor variationContextAccessor, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content item. |
IVariationContextAccessor | variationContextAccessor | |
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 |
---|---|
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.
Children<T>(IPublishedContent, IVariationContextAccessor, String)
Gets the children of the content, of a given content type.
Declaration
public static IEnumerable<T> Children<T>(this IPublishedContent content, IVariationContextAccessor variationContextAccessor, string culture = null)
where T : class, IPublishedContent
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content. |
IVariationContextAccessor | variationContextAccessor | The accessor for the VariationContext |
System.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.
ChildrenAsTable(IPublishedContent, IVariationContextAccessor, IContentTypeService, IMediaTypeService, IMemberTypeService, IPublishedUrlProvider, String, String)
Gets the children of the content in a DataTable.
Declaration
public static DataTable ChildrenAsTable(this IPublishedContent content, IVariationContextAccessor variationContextAccessor, IContentTypeService contentTypeService, IMediaTypeService mediaTypeService, IMemberTypeService memberTypeService, IPublishedUrlProvider publishedUrlProvider, string contentTypeAliasFilter = "", string culture = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content. |
IVariationContextAccessor | variationContextAccessor | Variation context accessor. |
IContentTypeService | contentTypeService | The content type service. |
IMediaTypeService | mediaTypeService | The media type service. |
IMemberTypeService | memberTypeService | The member type service. |
IPublishedUrlProvider | publishedUrlProvider | The published url provider. |
System.String | contentTypeAliasFilter | An optional content type alias. |
System.String | culture | The specific culture to filter for. If null is used the current culture is used. (Default is null) |
Returns
Type | Description |
---|---|
System.Data.DataTable | The children of the content. |
ChildrenOfType(IPublishedContent, IVariationContextAccessor, String, String)
Gets the children of the content, of any of the specified types.
Declaration
public static IEnumerable<IPublishedContent> ChildrenOfType(this IPublishedContent content, IVariationContextAccessor variationContextAccessor, string contentTypeAlias, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content. |
IVariationContextAccessor | variationContextAccessor | The accessor for the VariationContext |
System.String | contentTypeAlias | The content type alias. |
System.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. |
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 | |
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 |
---|---|
DateTime |
Descendant(IPublishedContent, IVariationContextAccessor, Int32, String)
Declaration
public static IPublishedContent Descendant(this IPublishedContent content, IVariationContextAccessor variationContextAccessor, int level, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
IVariationContextAccessor | variationContextAccessor | |
System.Int32 | level | |
System.String | culture |
Returns
Type | Description |
---|---|
IPublishedContent |
Descendant(IPublishedContent, IVariationContextAccessor, String)
Declaration
public static IPublishedContent Descendant(this IPublishedContent content, IVariationContextAccessor variationContextAccessor, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
IVariationContextAccessor | variationContextAccessor | |
System.String | culture |
Returns
Type | Description |
---|---|
IPublishedContent |
Descendant<T>(IPublishedContent, IVariationContextAccessor, Int32, String)
Declaration
public static T Descendant<T>(this IPublishedContent content, IVariationContextAccessor variationContextAccessor, int level, string culture = null)
where T : class, IPublishedContent
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
IVariationContextAccessor | variationContextAccessor | |
System.Int32 | level | |
System.String | culture |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
Descendant<T>(IPublishedContent, IVariationContextAccessor, String)
Declaration
public static T Descendant<T>(this IPublishedContent content, IVariationContextAccessor variationContextAccessor, string culture = null)
where T : class, IPublishedContent
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
IVariationContextAccessor | variationContextAccessor | |
System.String | culture |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
DescendantOfType(IPublishedContent, IVariationContextAccessor, String, String)
Declaration
public static IPublishedContent DescendantOfType(this IPublishedContent content, IVariationContextAccessor variationContextAccessor, string contentTypeAlias, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
IVariationContextAccessor | variationContextAccessor | |
System.String | contentTypeAlias | |
System.String | culture |
Returns
Type | Description |
---|---|
IPublishedContent |
DescendantOrSelf(IPublishedContent, IVariationContextAccessor, Int32, String)
Declaration
public static IPublishedContent DescendantOrSelf(this IPublishedContent content, IVariationContextAccessor variationContextAccessor, int level, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
IVariationContextAccessor | variationContextAccessor | |
System.Int32 | level | |
System.String | culture |
Returns
Type | Description |
---|---|
IPublishedContent |
DescendantOrSelf(IPublishedContent, IVariationContextAccessor, String)
Declaration
public static IPublishedContent DescendantOrSelf(this IPublishedContent content, IVariationContextAccessor variationContextAccessor, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
IVariationContextAccessor | variationContextAccessor | |
System.String | culture |
Returns
Type | Description |
---|---|
IPublishedContent |
DescendantOrSelf<T>(IPublishedContent, IVariationContextAccessor, Int32, String)
Declaration
public static T DescendantOrSelf<T>(this IPublishedContent content, IVariationContextAccessor variationContextAccessor, int level, string culture = null)
where T : class, IPublishedContent
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
IVariationContextAccessor | variationContextAccessor | |
System.Int32 | level | |
System.String | culture |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
DescendantOrSelf<T>(IPublishedContent, IVariationContextAccessor, String)
Declaration
public static T DescendantOrSelf<T>(this IPublishedContent content, IVariationContextAccessor variationContextAccessor, string culture = null)
where T : class, IPublishedContent
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
IVariationContextAccessor | variationContextAccessor | |
System.String | culture |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
DescendantOrSelfOfType(IPublishedContent, IVariationContextAccessor, String, String)
Declaration
public static IPublishedContent DescendantOrSelfOfType(this IPublishedContent content, IVariationContextAccessor variationContextAccessor, string contentTypeAlias, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
IVariationContextAccessor | variationContextAccessor | |
System.String | contentTypeAlias | |
System.String | culture |
Returns
Type | Description |
---|---|
IPublishedContent |
Descendants(IPublishedContent, IVariationContextAccessor, Int32, String)
Declaration
public static IEnumerable<IPublishedContent> Descendants(this IPublishedContent content, IVariationContextAccessor variationContextAccessor, int level, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
IVariationContextAccessor | variationContextAccessor | |
System.Int32 | level | |
System.String | culture |
Returns
Type | Description |
---|---|
IEnumerable<IPublishedContent> |
Descendants(IPublishedContent, IVariationContextAccessor, String)
Declaration
public static IEnumerable<IPublishedContent> Descendants(this IPublishedContent content, IVariationContextAccessor variationContextAccessor, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
IVariationContextAccessor | variationContextAccessor | |
System.String | culture |
Returns
Type | Description |
---|---|
IEnumerable<IPublishedContent> |
Descendants<T>(IPublishedContent, IVariationContextAccessor, Int32, String)
Declaration
public static IEnumerable<T> Descendants<T>(this IPublishedContent content, IVariationContextAccessor variationContextAccessor, int level, string culture = null)
where T : class, IPublishedContent
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
IVariationContextAccessor | variationContextAccessor | |
System.Int32 | level | |
System.String | culture |
Returns
Type | Description |
---|---|
IEnumerable<T> |
Type Parameters
Name | Description |
---|---|
T |
Descendants<T>(IPublishedContent, IVariationContextAccessor, String)
Declaration
public static IEnumerable<T> Descendants<T>(this IPublishedContent content, IVariationContextAccessor variationContextAccessor, string culture = null)
where T : class, IPublishedContent
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
IVariationContextAccessor | variationContextAccessor | |
System.String | culture |
Returns
Type | Description |
---|---|
IEnumerable<T> |
Type Parameters
Name | Description |
---|---|
T |
DescendantsOfType(IPublishedContent, IVariationContextAccessor, String, String)
Declaration
public static IEnumerable<IPublishedContent> DescendantsOfType(this IPublishedContent content, IVariationContextAccessor variationContextAccessor, string contentTypeAlias, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
IVariationContextAccessor | variationContextAccessor | |
System.String | contentTypeAlias | |
System.String | culture |
Returns
Type | Description |
---|---|
IEnumerable<IPublishedContent> |
DescendantsOrSelf(IPublishedContent, IVariationContextAccessor, Int32, String)
Declaration
public static IEnumerable<IPublishedContent> DescendantsOrSelf(this IPublishedContent content, IVariationContextAccessor variationContextAccessor, int level, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
IVariationContextAccessor | variationContextAccessor | |
System.Int32 | level | |
System.String | culture |
Returns
Type | Description |
---|---|
IEnumerable<IPublishedContent> |
DescendantsOrSelf(IPublishedContent, IVariationContextAccessor, String)
Declaration
public static IEnumerable<IPublishedContent> DescendantsOrSelf(this IPublishedContent content, IVariationContextAccessor variationContextAccessor, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
IVariationContextAccessor | variationContextAccessor | |
System.String | culture |
Returns
Type | Description |
---|---|
IEnumerable<IPublishedContent> |
DescendantsOrSelf<T>(IEnumerable<IPublishedContent>, IVariationContextAccessor, String)
Returns all DescendantsOrSelf of all content referenced
Declaration
public static IEnumerable<T> DescendantsOrSelf<T>(this IEnumerable<IPublishedContent> parentNodes, IVariationContextAccessor variationContextAccessor, string culture = null)
where T : class, IPublishedContent
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<IPublishedContent> | parentNodes | |
IVariationContextAccessor | variationContextAccessor | Variation context accessor. |
System.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> |
Type Parameters
Name | Description |
---|---|
T |
Remarks
This can be useful in order to return all nodes in an entire site by a type when combined with TypedContentAtRoot
DescendantsOrSelf<T>(IPublishedContent, IVariationContextAccessor, Int32, String)
Declaration
public static IEnumerable<T> DescendantsOrSelf<T>(this IPublishedContent content, IVariationContextAccessor variationContextAccessor, int level, string culture = null)
where T : class, IPublishedContent
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
IVariationContextAccessor | variationContextAccessor | |
System.Int32 | level | |
System.String | culture |
Returns
Type | Description |
---|---|
IEnumerable<T> |
Type Parameters
Name | Description |
---|---|
T |
DescendantsOrSelf<T>(IPublishedContent, IVariationContextAccessor, String)
Declaration
public static IEnumerable<T> DescendantsOrSelf<T>(this IPublishedContent content, IVariationContextAccessor variationContextAccessor, string culture = null)
where T : class, IPublishedContent
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
IVariationContextAccessor | variationContextAccessor | |
System.String | culture |
Returns
Type | Description |
---|---|
IEnumerable<T> |
Type Parameters
Name | Description |
---|---|
T |
DescendantsOrSelfOfType(IEnumerable<IPublishedContent>, IVariationContextAccessor, String, String)
Returns all DescendantsOrSelf of all content referenced
Declaration
public static IEnumerable<IPublishedContent> DescendantsOrSelfOfType(this IEnumerable<IPublishedContent> parentNodes, IVariationContextAccessor variationContextAccessor, string docTypeAlias, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<IPublishedContent> | parentNodes | |
IVariationContextAccessor | variationContextAccessor | Variation context accessor. |
System.String | docTypeAlias | |
System.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> |
Remarks
This can be useful in order to return all nodes in an entire site by a type when combined with TypedContentAtRoot
DescendantsOrSelfOfType(IPublishedContent, IVariationContextAccessor, String, String)
Declaration
public static IEnumerable<IPublishedContent> DescendantsOrSelfOfType(this IPublishedContent content, IVariationContextAccessor variationContextAccessor, string contentTypeAlias, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
IVariationContextAccessor | variationContextAccessor | |
System.String | contentTypeAlias | |
System.String | culture |
Returns
Type | Description |
---|---|
IEnumerable<IPublishedContent> |
FirstChild(IPublishedContent, IVariationContextAccessor, Func<IPublishedContent, Boolean>, String)
Declaration
public static IPublishedContent FirstChild(this IPublishedContent content, IVariationContextAccessor variationContextAccessor, Func<IPublishedContent, bool> predicate, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
IVariationContextAccessor | variationContextAccessor | |
Func<IPublishedContent, System.Boolean> | predicate | |
System.String | culture |
Returns
Type | Description |
---|---|
IPublishedContent |
FirstChild(IPublishedContent, IVariationContextAccessor, Guid, String)
Declaration
public static IPublishedContent FirstChild(this IPublishedContent content, IVariationContextAccessor variationContextAccessor, Guid uniqueId, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
IVariationContextAccessor | variationContextAccessor | |
Guid | uniqueId | |
System.String | culture |
Returns
Type | Description |
---|---|
IPublishedContent |
FirstChild(IPublishedContent, IVariationContextAccessor, String)
Declaration
public static IPublishedContent FirstChild(this IPublishedContent content, IVariationContextAccessor variationContextAccessor, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
IVariationContextAccessor | variationContextAccessor | |
System.String | culture |
Returns
Type | Description |
---|---|
IPublishedContent |
FirstChild<T>(IPublishedContent, IVariationContextAccessor, Func<T, Boolean>, String)
Declaration
public static T FirstChild<T>(this IPublishedContent content, IVariationContextAccessor variationContextAccessor, Func<T, bool> predicate, string culture = null)
where T : class, IPublishedContent
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
IVariationContextAccessor | variationContextAccessor | |
Func<T, System.Boolean> | predicate | |
System.String | culture |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
FirstChild<T>(IPublishedContent, IVariationContextAccessor, String)
Declaration
public static T FirstChild<T>(this IPublishedContent content, IVariationContextAccessor variationContextAccessor, string culture = null)
where T : class, IPublishedContent
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
IVariationContextAccessor | variationContextAccessor | |
System.String | culture |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
FirstChildOfType(IPublishedContent, IVariationContextAccessor, String, String)
Gets the first child of the content, of a given content type.
Declaration
public static IPublishedContent FirstChildOfType(this IPublishedContent content, IVariationContextAccessor variationContextAccessor, string contentTypeAlias, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
IVariationContextAccessor | variationContextAccessor | |
System.String | contentTypeAlias | |
System.String | culture |
Returns
Type | Description |
---|---|
IPublishedContent |
GetCreatorName(IPublishedContent, IUserService)
Declaration
public static string GetCreatorName(this IPublishedContent content, IUserService userService)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
IUserService | userService |
Returns
Type | Description |
---|---|
System.String |
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 |
---|---|
System.String | Empty string if none is set. |
GetWriterName(IPublishedContent, IUserService)
Declaration
public static string GetWriterName(this IPublishedContent content, IUserService userService)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
IUserService | userService |
Returns
Type | Description |
---|---|
System.String |
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.
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(Fallback))
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content. |
IPublishedValueFallback | publishedValueFallback | The published value fallback implementation. |
System.String | alias | The property alias. |
System.String | culture | The variation language. |
System.String | segment | The variation segment. |
Fallback | fallback | Optional fallback strategy. |
Returns
Type | Description |
---|---|
System.Boolean | 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, Boolean, Boolean, Int32)
Declaration
public static bool IsAllowedTemplate(this IPublishedContent content, IContentTypeService contentTypeService, bool disableAlternativeTemplates, bool validateAlternativeTemplates, int templateId)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
IContentTypeService | contentTypeService | |
System.Boolean | disableAlternativeTemplates | |
System.Boolean | validateAlternativeTemplates | |
System.Int32 | templateId |
Returns
Type | Description |
---|---|
System.Boolean |
IsAllowedTemplate(IPublishedContent, IContentTypeService, WebRoutingSettings, Int32)
Declaration
public static bool IsAllowedTemplate(this IPublishedContent content, IContentTypeService contentTypeService, WebRoutingSettings webRoutingSettings, int templateId)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
IContentTypeService | contentTypeService | |
WebRoutingSettings | webRoutingSettings | |
System.Int32 | templateId |
Returns
Type | Description |
---|---|
System.Boolean |
IsAllowedTemplate(IPublishedContent, IFileService, IContentTypeService, Boolean, Boolean, String)
Declaration
public static bool IsAllowedTemplate(this IPublishedContent content, IFileService fileService, IContentTypeService contentTypeService, bool disableAlternativeTemplates, bool validateAlternativeTemplates, string templateAlias)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
IFileService | fileService | |
IContentTypeService | contentTypeService | |
System.Boolean | disableAlternativeTemplates | |
System.Boolean | validateAlternativeTemplates | |
System.String | templateAlias |
Returns
Type | Description |
---|---|
System.Boolean |
IsAncestor(IPublishedContent, IPublishedContent)
Declaration
public static bool IsAncestor(this IPublishedContent content, IPublishedContent other)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
IPublishedContent | other |
Returns
Type | Description |
---|---|
System.Boolean |
IsAncestorOrSelf(IPublishedContent, IPublishedContent)
Declaration
public static bool IsAncestorOrSelf(this IPublishedContent content, IPublishedContent other)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
IPublishedContent | other |
Returns
Type | Description |
---|---|
System.Boolean |
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. |
System.String | alias | The content type alias. |
Returns
Type | Description |
---|---|
System.Boolean | A value indicating whether the content is of a content type composed of a content type identified by the alias. |
IsDescendant(IPublishedContent, IPublishedContent)
Declaration
public static bool IsDescendant(this IPublishedContent content, IPublishedContent other)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
IPublishedContent | other |
Returns
Type | Description |
---|---|
System.Boolean |
IsDescendantOrSelf(IPublishedContent, IPublishedContent)
Declaration
public static bool IsDescendantOrSelf(this IPublishedContent content, IPublishedContent other)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
IPublishedContent | other |
Returns
Type | Description |
---|---|
System.Boolean |
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. |
System.String | docTypeAlias | The alias of the content type to test against. |
Returns
Type | Description |
---|---|
System.Boolean | True if the content is of the specified content type; otherwise false. |
IsDocumentType(IPublishedContent, String, Boolean)
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. |
System.String | docTypeAlias | The alias of the content type to test against. |
System.Boolean | 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 |
---|---|
System.Boolean | True if the content is of the specified content type or a derived content type; otherwise false. |
IsEqual(IPublishedContent, IPublishedContent)
Declaration
public static bool IsEqual(this IPublishedContent content, IPublishedContent other)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
IPublishedContent | other |
Returns
Type | Description |
---|---|
System.Boolean |
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.
IsNotEqual(IPublishedContent, IPublishedContent)
Declaration
public static bool IsNotEqual(this IPublishedContent content, IPublishedContent other)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
IPublishedContent | other |
Returns
Type | Description |
---|---|
System.Boolean |
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 | |
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 |
Parent<T>(IPublishedContent)
Gets the parent of the content, of a given content type.
Declaration
public static T Parent<T>(this IPublishedContent content)
where T : class, IPublishedContent
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content. |
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)
Gets the root content (ancestor or self at level 1) for the specified content
.
Declaration
public static IPublishedContent Root(this IPublishedContent content)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content. |
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, Int32) with maxLevel
set to 1.
Root<T>(IPublishedContent)
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)
where T : class, IPublishedContent
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content. |
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, Int32) with
maxLevel
set to 1.
Siblings(IPublishedContent, IPublishedSnapshot, IVariationContextAccessor, String)
Gets the siblings of the content.
Declaration
public static IEnumerable<IPublishedContent> Siblings(this IPublishedContent content, IPublishedSnapshot publishedSnapshot, IVariationContextAccessor variationContextAccessor, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content. |
IPublishedSnapshot | publishedSnapshot | Published snapshot instance |
IVariationContextAccessor | variationContextAccessor | Variation context accessor. |
System.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.
Siblings<T>(IPublishedContent, IPublishedSnapshot, IVariationContextAccessor, String)
Gets the siblings of the content, of a given content type.
Declaration
public static IEnumerable<T> Siblings<T>(this IPublishedContent content, IPublishedSnapshot publishedSnapshot, IVariationContextAccessor variationContextAccessor, string culture = null)
where T : class, IPublishedContent
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content. |
IPublishedSnapshot | publishedSnapshot | Published snapshot instance |
IVariationContextAccessor | variationContextAccessor | Variation context accessor. |
System.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.
SiblingsAndSelf(IPublishedContent, IPublishedSnapshot, IVariationContextAccessor, String)
Gets the siblings of the content including the node itself to indicate the position.
Declaration
public static IEnumerable<IPublishedContent>? SiblingsAndSelf(this IPublishedContent content, IPublishedSnapshot publishedSnapshot, IVariationContextAccessor variationContextAccessor, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content. |
IPublishedSnapshot | publishedSnapshot | Published snapshot instance |
IVariationContextAccessor | variationContextAccessor | Variation context accessor. |
System.String | culture | The specific culture to filter for. If null is used the current culture is used. (Default is null) |
Returns
Type | Description |
---|---|
System.Nullable<IEnumerable<IPublishedContent>> | The siblings of the content including the node itself. |
SiblingsAndSelf<T>(IPublishedContent, IPublishedSnapshot, IVariationContextAccessor, 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, IPublishedSnapshot publishedSnapshot, IVariationContextAccessor variationContextAccessor, string culture = null)
where T : class, IPublishedContent
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content. |
IPublishedSnapshot | publishedSnapshot | Published snapshot instance |
IVariationContextAccessor | variationContextAccessor | Variation context accessor. |
System.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. |
SiblingsAndSelfOfType(IPublishedContent, IPublishedSnapshot, IVariationContextAccessor, 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, IPublishedSnapshot publishedSnapshot, IVariationContextAccessor variationContextAccessor, string contentTypeAlias, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content. |
IPublishedSnapshot | publishedSnapshot | Published snapshot instance |
IVariationContextAccessor | variationContextAccessor | Variation context accessor. |
System.String | contentTypeAlias | The content type alias. |
System.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. |
SiblingsOfType(IPublishedContent, IPublishedSnapshot, IVariationContextAccessor, String, String)
Gets the siblings of the content, of a given content type.
Declaration
public static IEnumerable<IPublishedContent> SiblingsOfType(this IPublishedContent content, IPublishedSnapshot publishedSnapshot, IVariationContextAccessor variationContextAccessor, string contentTypeAlias, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content. |
IPublishedSnapshot | publishedSnapshot | Published snapshot instance |
IVariationContextAccessor | variationContextAccessor | Variation context accessor. |
System.String | contentTypeAlias | The content type alias. |
System.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.
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 | |
System.String | culture | |
UrlMode | mode |
Returns
Type | Description |
---|---|
System.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
public static string UrlSegment(this IPublishedContent content, IVariationContextAccessor variationContextAccessor, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content item. |
IVariationContextAccessor | variationContextAccessor | |
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 |
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(Fallback), object defaultValue = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content. |
IPublishedValueFallback | publishedValueFallback | The published value fallback implementation. |
System.String | alias | The property alias. |
System.String | culture | The variation language. |
System.String | segment | The variation segment. |
Fallback | fallback | Optional fallback strategy. |
System.Object | defaultValue | The default value. |
Returns
Type | Description |
---|---|
System.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(Fallback), T defaultValue = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content. |
IPublishedValueFallback | publishedValueFallback | The published value fallback implementation. |
System.String | alias | The property alias. |
System.String | culture | The variation language. |
System.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. |