View Source
Class FriendlyPublishedContentExtensions
Inheritance
System.Object
Assembly: Umbraco.Web.Common.dll
Syntax
public static class FriendlyPublishedContentExtensions
Methods
View Source
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.
|
View Source
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
VariationContext
|
Returns
View Source
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.
|
View Source
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.
|
View Source
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.
|
View Source
CreateModel(IPublishedContent)
Creates a strongly typed published content model for an internal published content.
Declaration
public static IPublishedContent CreateModel(this IPublishedContent content)
Parameters
Returns
View Source
CreatorName(IPublishedContent)
Gets the name of the content item creator.
Declaration
public static string CreatorName(this IPublishedContent content)
Parameters
Returns
| Type |
Description |
| System.String |
|
View Source
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 |
|
View Source
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
View Source
Descendant(IPublishedContent, String)
Declaration
public static IPublishedContent Descendant(this IPublishedContent content, string culture = null)
Parameters
Returns
View Source
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 Parameters
View Source
Descendant<T>(IPublishedContent, String)
Declaration
public static T Descendant<T>(this IPublishedContent content, string culture = null)
where T : class, IPublishedContent
Parameters
Returns
Type Parameters
View Source
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
View Source
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
View Source
DescendantOrSelf(IPublishedContent, String)
Declaration
public static IPublishedContent DescendantOrSelf(this IPublishedContent content, string culture = null)
Parameters
Returns
View Source
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 Parameters
View Source
DescendantOrSelf<T>(IPublishedContent, String)
Declaration
public static T DescendantOrSelf<T>(this IPublishedContent content, string culture = null)
where T : class, IPublishedContent
Parameters
Returns
Type Parameters
View Source
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
View Source
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
View Source
Descendants(IPublishedContent, String)
Declaration
public static IEnumerable<IPublishedContent> Descendants(this IPublishedContent content, string culture = null)
Parameters
Returns
View Source
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
View Source
Descendants<T>(IPublishedContent, String)
Declaration
public static IEnumerable<T> Descendants<T>(this IPublishedContent content, string culture = null)
where T : class, IPublishedContent
Parameters
Returns
| Type |
Description |
| IEnumerable<T> |
|
Type Parameters
View Source
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
View Source
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
View Source
DescendantsOrSelf(IPublishedContent, String)
Declaration
public static IEnumerable<IPublishedContent> DescendantsOrSelf(this IPublishedContent content, string culture = null)
Parameters
Returns
View Source
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
View Source
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
View Source
DescendantsOrSelf<T>(IPublishedContent, String)
Declaration
public static IEnumerable<T> DescendantsOrSelf<T>(this IPublishedContent content, string culture = null)
where T : class, IPublishedContent
Parameters
Returns
| Type |
Description |
| IEnumerable<T> |
|
Type Parameters
View Source
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
View Source
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
View Source
FirstChild(IPublishedContent, Func<IPublishedContent, Boolean>, String)
Declaration
public static IPublishedContent FirstChild(this IPublishedContent content, Func<IPublishedContent, bool> predicate, string culture = null)
Parameters
Returns
View Source
FirstChild(IPublishedContent, Guid, String)
Declaration
public static IPublishedContent FirstChild(this IPublishedContent content, Guid uniqueId, string culture = null)
Parameters
Returns
View Source
FirstChild(IPublishedContent, String)
Declaration
public static IPublishedContent FirstChild(this IPublishedContent content, string culture = null)
Parameters
Returns
View Source
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 Parameters
View Source
FirstChild<T>(IPublishedContent, String)
Declaration
public static T FirstChild<T>(this IPublishedContent content, string culture = null)
where T : class, IPublishedContent
Parameters
Returns
Type Parameters
View Source
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
View Source
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
View Source
GetTemplateAlias(IPublishedContent)
Returns the current template Alias
Declaration
public static string GetTemplateAlias(this IPublishedContent content)
Parameters
Returns
| Type |
Description |
| System.String |
Empty string if none is set.
|
View Source
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 = default(Fallback))
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.
|
View Source
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 |
|
View Source
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 |
|
View Source
IsAllowedTemplate(IPublishedContent, Int32)
Declaration
public static bool IsAllowedTemplate(this IPublishedContent content, int templateId)
Parameters
Returns
| Type |
Description |
| System.Boolean |
|
View Source
IsAllowedTemplate(IPublishedContent, String)
Declaration
public static bool IsAllowedTemplate(this IPublishedContent content, string templateAlias)
Parameters
Returns
| Type |
Description |
| System.Boolean |
|
View Source
MediaUrl(IPublishedContent, String, UrlMode, String)
Gets the url for a media.
Declaration
public static string MediaUrl(this IPublishedContent content, string culture = null, UrlMode mode = UrlMode.Default, string propertyAlias = "umbracoFile")
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.
|
View Source
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 |
|
View Source
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
View Source
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
View Source
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.
|
View Source
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.
|
View Source
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.
|
View Source
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.
|
View Source
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.
|
View Source
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.
|
View Source
Url(IPublishedContent, String, UrlMode)
Gets the url of the content item.
Declaration
public static string Url(this IPublishedContent content, string culture = null, UrlMode mode = UrlMode.Default)
Parameters
Returns
| Type |
Description |
| System.String |
|
View Source
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 |
|
View Source
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 = default(Fallback), 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.
|
View Source
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 = default(Fallback), 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.
|
View Source
WriterName(IPublishedContent)
Gets the name of the content item writer.
Declaration
public static string WriterName(this IPublishedContent content)
Parameters
Returns
| Type |
Description |
| System.String |
|