Class FriendlyPublishedContentExtensions
Inheritance
Namespace: Umbraco.Extensions
Assembly: Umbraco.Web.Common.dll
Syntax
public static class FriendlyPublishedContentExtensions
Methods
View SourceAncestor(IPublishedContent)
Gets the ancestor of the content, i.e. its parent.
Declaration
public static IPublishedContent? Ancestor(this IPublishedContent content)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content. |
Returns
Type | Description |
---|---|
System.Nullable<IPublishedContent> | The ancestor of the content. |
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
.
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
.
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.
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<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.
Children(IPublishedContent, Func<IPublishedContent, Boolean>, String)
Gets the children of the content, filtered by a predicate.
Declaration
public static IEnumerable<IPublishedContent>? Children(this IPublishedContent content, Func<IPublishedContent, bool> predicate, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content. |
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 |
---|---|
System.Nullable<IEnumerable<IPublishedContent>> | The children of the content, filtered by the predicate. |
Remarks
Children are sorted by their sortOrder.
Children(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
|
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
Children<T>(IPublishedContent, String)
Gets the children of the content, of a given content type.
Declaration
public static IEnumerable<T>? Children<T>(this IPublishedContent content, string culture = null)
where T : class, IPublishedContent
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content. |
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<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, String, String)
Gets the children of the content in a DataTable.
Declaration
public static DataTable ChildrenAsTable(this IPublishedContent content, string contentTypeAliasFilter = "", string culture = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content. |
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, String, String)
Gets the children of the content, of any of the specified types.
Declaration
public static IEnumerable<IPublishedContent>? ChildrenOfType(this IPublishedContent content, string contentTypeAlias, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content. |
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 |
---|---|
System.Nullable<IEnumerable<IPublishedContent>> | The children of the content, of any of the specified types. |
CreateModel(IPublishedContent)
Creates a strongly typed published content model for an internal published content.
Declaration
public static IPublishedContent? CreateModel(this IPublishedContent content)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The internal published content. |
Returns
Type | Description |
---|---|
System.Nullable<IPublishedContent> | The strongly typed published content model. |
CreatorName(IPublishedContent)
Gets the name of the content item creator.
Declaration
public static string CreatorName(this IPublishedContent content)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content item. |
Returns
Type | Description |
---|---|
System.String |
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 |
---|---|
DateTime |
Descendant(IPublishedContent, Int32, String)
Declaration
public static IPublishedContent? Descendant(this IPublishedContent content, int level, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
System.Int32 | level | |
System.String | culture |
Returns
Type | Description |
---|---|
System.Nullable<IPublishedContent> |
Descendant(IPublishedContent, String)
Declaration
public static IPublishedContent? Descendant(this IPublishedContent content, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
System.String | culture |
Returns
Type | Description |
---|---|
System.Nullable<IPublishedContent> |
Descendant<T>(IPublishedContent, Int32, String)
Declaration
public static T Descendant<T>(this IPublishedContent content, int level, string culture = null)
where T : class, IPublishedContent
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
System.Int32 | level | |
System.String | culture |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
Descendant<T>(IPublishedContent, String)
Declaration
public static T Descendant<T>(this IPublishedContent content, string culture = null)
where T : class, IPublishedContent
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
System.String | culture |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
DescendantOfType(IPublishedContent, String, String)
Declaration
public static IPublishedContent? DescendantOfType(this IPublishedContent content, string contentTypeAlias, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
System.String | contentTypeAlias | |
System.String | culture |
Returns
Type | Description |
---|---|
System.Nullable<IPublishedContent> |
DescendantOrSelf(IPublishedContent, Int32, String)
Declaration
public static IPublishedContent? DescendantOrSelf(this IPublishedContent content, int level, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
System.Int32 | level | |
System.String | culture |
Returns
Type | Description |
---|---|
System.Nullable<IPublishedContent> |
DescendantOrSelf(IPublishedContent, String)
Declaration
public static IPublishedContent DescendantOrSelf(this IPublishedContent content, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
System.String | culture |
Returns
Type | Description |
---|---|
IPublishedContent |
DescendantOrSelf<T>(IPublishedContent, Int32, String)
Declaration
public static T DescendantOrSelf<T>(this IPublishedContent content, int level, string culture = null)
where T : class, IPublishedContent
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
System.Int32 | level | |
System.String | culture |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
DescendantOrSelf<T>(IPublishedContent, String)
Declaration
public static T DescendantOrSelf<T>(this IPublishedContent content, string culture = null)
where T : class, IPublishedContent
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
System.String | culture |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
DescendantOrSelfOfType(IPublishedContent, String, String)
Declaration
public static IPublishedContent? DescendantOrSelfOfType(this IPublishedContent content, string contentTypeAlias, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
System.String | contentTypeAlias | |
System.String | culture |
Returns
Type | Description |
---|---|
System.Nullable<IPublishedContent> |
Descendants(IPublishedContent, Int32, String)
Declaration
public static IEnumerable<IPublishedContent> Descendants(this IPublishedContent content, int level, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
System.Int32 | level | |
System.String | culture |
Returns
Type | Description |
---|---|
IEnumerable<IPublishedContent> |
Descendants(IPublishedContent, String)
Declaration
public static IEnumerable<IPublishedContent> Descendants(this IPublishedContent content, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
System.String | culture |
Returns
Type | Description |
---|---|
IEnumerable<IPublishedContent> |
Descendants<T>(IPublishedContent, Int32, String)
Declaration
public static IEnumerable<T> Descendants<T>(this IPublishedContent content, int level, string culture = null)
where T : class, IPublishedContent
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
System.Int32 | level | |
System.String | culture |
Returns
Type | Description |
---|---|
IEnumerable<T> |
Type Parameters
Name | Description |
---|---|
T |
Descendants<T>(IPublishedContent, String)
Declaration
public static IEnumerable<T> Descendants<T>(this IPublishedContent content, string culture = null)
where T : class, IPublishedContent
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
System.String | culture |
Returns
Type | Description |
---|---|
IEnumerable<T> |
Type Parameters
Name | Description |
---|---|
T |
DescendantsOfType(IPublishedContent, String, String)
Declaration
public static IEnumerable<IPublishedContent> DescendantsOfType(this IPublishedContent content, string contentTypeAlias, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
System.String | contentTypeAlias | |
System.String | culture |
Returns
Type | Description |
---|---|
IEnumerable<IPublishedContent> |
DescendantsOrSelf(IPublishedContent, Int32, String)
Declaration
public static IEnumerable<IPublishedContent> DescendantsOrSelf(this IPublishedContent content, int level, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
System.Int32 | level | |
System.String | culture |
Returns
Type | Description |
---|---|
IEnumerable<IPublishedContent> |
DescendantsOrSelf(IPublishedContent, String)
Declaration
public static IEnumerable<IPublishedContent> DescendantsOrSelf(this IPublishedContent content, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
System.String | culture |
Returns
Type | Description |
---|---|
IEnumerable<IPublishedContent> |
DescendantsOrSelf<T>(IEnumerable<IPublishedContent>, String)
Returns all DescendantsOrSelf of all content referenced
Declaration
public static IEnumerable<T> DescendantsOrSelf<T>(this IEnumerable<IPublishedContent> parentNodes, string culture = null)
where T : class, IPublishedContent
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<IPublishedContent> | parentNodes | |
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, Int32, String)
Declaration
public static IEnumerable<T> DescendantsOrSelf<T>(this IPublishedContent content, int level, string culture = null)
where T : class, IPublishedContent
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
System.Int32 | level | |
System.String | culture |
Returns
Type | Description |
---|---|
IEnumerable<T> |
Type Parameters
Name | Description |
---|---|
T |
DescendantsOrSelf<T>(IPublishedContent, String)
Declaration
public static IEnumerable<T> DescendantsOrSelf<T>(this IPublishedContent content, string culture = null)
where T : class, IPublishedContent
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
System.String | culture |
Returns
Type | Description |
---|---|
IEnumerable<T> |
Type Parameters
Name | Description |
---|---|
T |
DescendantsOrSelfOfType(IEnumerable<IPublishedContent>, String, String)
Returns all DescendantsOrSelf of all content referenced
Declaration
public static IEnumerable<IPublishedContent> DescendantsOrSelfOfType(this IEnumerable<IPublishedContent> parentNodes, string docTypeAlias, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<IPublishedContent> | parentNodes | |
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, String, String)
Declaration
public static IEnumerable<IPublishedContent> DescendantsOrSelfOfType(this IPublishedContent content, string contentTypeAlias, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
System.String | contentTypeAlias | |
System.String | culture |
Returns
Type | Description |
---|---|
IEnumerable<IPublishedContent> |
FirstChild(IPublishedContent, Func<IPublishedContent, Boolean>, String)
Declaration
public static IPublishedContent? FirstChild(this IPublishedContent content, Func<IPublishedContent, bool> predicate, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
Func<IPublishedContent, System.Boolean> | predicate | |
System.String | culture |
Returns
Type | Description |
---|---|
System.Nullable<IPublishedContent> |
FirstChild(IPublishedContent, Guid, String)
Declaration
public static IPublishedContent? FirstChild(this IPublishedContent content, Guid uniqueId, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
Guid | uniqueId | |
System.String | culture |
Returns
Type | Description |
---|---|
System.Nullable<IPublishedContent> |
FirstChild(IPublishedContent, String)
Declaration
public static IPublishedContent? FirstChild(this IPublishedContent content, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
System.String | culture |
Returns
Type | Description |
---|---|
System.Nullable<IPublishedContent> |
FirstChild<T>(IPublishedContent, Func<T, Boolean>, String)
Declaration
public static T FirstChild<T>(this IPublishedContent content, Func<T, bool> predicate, string culture = null)
where T : class, IPublishedContent
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
Func<T, System.Boolean> | predicate | |
System.String | culture |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
FirstChild<T>(IPublishedContent, String)
Declaration
public static T FirstChild<T>(this IPublishedContent content, string culture = null)
where T : class, IPublishedContent
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
System.String | culture |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
FirstChildOfType(IPublishedContent, String, String)
Gets the first child of the content, of a given content type.
Declaration
public static IPublishedContent? FirstChildOfType(this IPublishedContent content, string contentTypeAlias, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
System.String | contentTypeAlias | |
System.String | culture |
Returns
Type | Description |
---|---|
System.Nullable<IPublishedContent> |
GetCultureFromDomains(IPublishedContent, Nullable<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, Uri? current = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The document. |
System.Nullable<Uri> | current | An optional current Uri. |
Returns
Type | Description |
---|---|
System.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)
Returns the current template Alias
Declaration
public static string GetTemplateAlias(this IPublishedContent content)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content |
Returns
Type | Description |
---|---|
System.String | Empty string if none is set. |
HasValue(IPublishedContent, 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, string alias, string culture = null, string segment = null, Fallback fallback = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content. |
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, Boolean, Boolean, Int32)
Declaration
public static bool IsAllowedTemplate(this IPublishedContent content, bool disableAlternativeTemplates, bool validateAlternativeTemplates, int templateId)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
System.Boolean | disableAlternativeTemplates | |
System.Boolean | validateAlternativeTemplates | |
System.Int32 | templateId |
Returns
Type | Description |
---|---|
System.Boolean |
IsAllowedTemplate(IPublishedContent, Boolean, Boolean, String)
Declaration
public static bool IsAllowedTemplate(this IPublishedContent content, bool disableAlternativeTemplates, bool validateAlternativeTemplates, string templateAlias)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
System.Boolean | disableAlternativeTemplates | |
System.Boolean | validateAlternativeTemplates | |
System.String | templateAlias |
Returns
Type | Description |
---|---|
System.Boolean |
IsAllowedTemplate(IPublishedContent, Int32)
Declaration
public static bool IsAllowedTemplate(this IPublishedContent content, int templateId)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
System.Int32 | templateId |
Returns
Type | Description |
---|---|
System.Boolean |
IsAllowedTemplate(IPublishedContent, String)
Declaration
public static bool IsAllowedTemplate(this IPublishedContent content, string templateAlias)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
System.String | templateAlias |
Returns
Type | Description |
---|---|
System.Boolean |
MediaUrl(IPublishedContent, String, UrlMode, String)
Gets the url for a media.
Declaration
public static string MediaUrl(this IPublishedContent content, string culture = null, UrlMode mode = null, string propertyAlias = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content item. |
System.String | culture | The culture (use current culture by default). |
UrlMode | mode | The url mode (use site configuration by default). |
System.String | propertyAlias | The alias of the property (use 'umbracoFile' by default). |
Returns
Type | Description |
---|---|
System.String | The url for the media. |
Remarks
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.
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 |
Parent(IPublishedContent)
Gets the parent of the content item.
Declaration
public static IPublishedContent? Parent(this IPublishedContent content)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content. |
Returns
Type | Description |
---|---|
System.Nullable<IPublishedContent> | The parent of content or |
Parent<T>(IPublishedContent)
Gets the parent of the content item.
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 specified content type or |
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
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
maxLevel
set to 1.
SearchChildren(IPublishedContent, String, String)
Declaration
public static IEnumerable<PublishedSearchResult> SearchChildren(this IPublishedContent content, string term, string indexName = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
System.String | term | |
System.String | indexName |
Returns
Type | Description |
---|---|
IEnumerable<PublishedSearchResult> |
SearchDescendants(IPublishedContent, String, String)
Declaration
public static IEnumerable<PublishedSearchResult> SearchDescendants(this IPublishedContent content, string term, string indexName = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
System.String | term | |
System.String | indexName |
Returns
Type | Description |
---|---|
IEnumerable<PublishedSearchResult> |
Siblings(IPublishedContent, String)
Gets the siblings of the content.
Declaration
public static IEnumerable<IPublishedContent>? Siblings(this IPublishedContent content, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content. |
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. |
Remarks
Note that in V7 this method also return the content node self.
Siblings<T>(IPublishedContent, String)
Gets the siblings of the content, of a given content type.
Declaration
public static IEnumerable<T>? Siblings<T>(this IPublishedContent content, string culture = null)
where T : class, IPublishedContent
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content. |
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<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, String)
Gets the siblings of the content including the node itself to indicate the position.
Declaration
public static IEnumerable<IPublishedContent>? SiblingsAndSelf(this IPublishedContent content, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content. |
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, 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, string culture = null)
where T : class, IPublishedContent
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content. |
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<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, 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, string contentTypeAlias, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content. |
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 |
---|---|
System.Nullable<IEnumerable<IPublishedContent>> | The siblings of the content including the node itself, of the given content type. |
SiblingsOfType(IPublishedContent, String, String)
Gets the siblings of the content, of a given content type.
Declaration
public static IEnumerable<IPublishedContent>? SiblingsOfType(this IPublishedContent content, string contentTypeAlias, string culture = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content. |
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 |
---|---|
System.Nullable<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, String, UrlMode)
Gets the url of the content item.
Declaration
public static string Url(this IPublishedContent content, string culture = null, UrlMode mode = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | |
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, 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 |
Value(IPublishedContent, 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, string alias, string culture = null, string segment = null, Fallback fallback = null, object defaultValue = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content. |
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, 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, string alias, string culture = null, string segment = null, Fallback fallback = null, T defaultValue = null)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content. |
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. |
WriterName(IPublishedContent)
Gets the name of the content item writer.
Declaration
public static string WriterName(this IPublishedContent content)
Parameters
Type | Name | Description |
---|---|---|
IPublishedContent | content | The content item. |
Returns
Type | Description |
---|---|
System.String |