Table of Contents

Class PublishedContentExtensions

Namespace
Umbraco.Extensions
Assembly
Umbraco.Web.Common.dll
public static class PublishedContentExtensions
Inheritance
PublishedContentExtensions
Inherited Members

Methods

CreatorName(IPublishedContent, IUserService)

Gets the name of the content item creator.

public static string? CreatorName(this IPublishedContent content, IUserService userService)

Parameters

content IPublishedContent

The content item.

userService IUserService

Returns

string

GetCultureFromDomains(IPublishedContent, IUmbracoContextAccessor, ISiteDomainMapper, Uri?)

Gets the culture assigned to a document by domains, in the context of a current Uri.

public static string? GetCultureFromDomains(this IPublishedContent content, IUmbracoContextAccessor umbracoContextAccessor, ISiteDomainMapper siteDomainHelper, Uri? current = null)

Parameters

content IPublishedContent

The document.

umbracoContextAccessor IUmbracoContextAccessor
siteDomainHelper ISiteDomainMapper
current Uri

An optional current Uri.

Returns

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.

IsAncestor(IPublishedContent, IPublishedContent, string)

public static IHtmlContent IsAncestor(this IPublishedContent content, IPublishedContent other, string valueIfTrue)

Parameters

content IPublishedContent
other IPublishedContent
valueIfTrue string

Returns

IHtmlContent

IsAncestor(IPublishedContent, IPublishedContent, string, string)

If the specified content is an ancestor of other, the HTML encoded valueIfTrue will be returned; otherwise, valueIfFalse.

public static IHtmlContent IsAncestor(this IPublishedContent content, IPublishedContent other, string valueIfTrue, string valueIfFalse)

Parameters

content IPublishedContent

The content.

other IPublishedContent

The other content.

valueIfTrue string

The value if true.

valueIfFalse string

The value if false.

Returns

IHtmlContent

The HTML encoded value.

IsAncestorOrSelf(IPublishedContent, IPublishedContent, string)

public static IHtmlContent IsAncestorOrSelf(this IPublishedContent content, IPublishedContent other, string valueIfTrue)

Parameters

content IPublishedContent
other IPublishedContent
valueIfTrue string

Returns

IHtmlContent

IsAncestorOrSelf(IPublishedContent, IPublishedContent, string, string)

If the specified content is an ancestor of other or are the same, the HTML encoded valueIfTrue will be returned; otherwise, valueIfFalse.

public static IHtmlContent IsAncestorOrSelf(this IPublishedContent content, IPublishedContent other, string valueIfTrue, string valueIfFalse)

Parameters

content IPublishedContent

The content.

other IPublishedContent

The other content.

valueIfTrue string

The value if true.

valueIfFalse string

The value if false.

Returns

IHtmlContent

The HTML encoded value.

IsDescendant(IPublishedContent, IPublishedContent, string)

If the specified content is a decendant of other, the HTML encoded valueIfTrue will be returned; otherwise, Empty.

public static IHtmlContent IsDescendant(this IPublishedContent content, IPublishedContent other, string valueIfTrue)

Parameters

content IPublishedContent

The content.

other IPublishedContent

The other content.

valueIfTrue string

The value if true.

Returns

IHtmlContent

The HTML encoded value.

IsDescendant(IPublishedContent, IPublishedContent, string, string)

If the specified content is a decendant of other, the HTML encoded valueIfTrue will be returned; otherwise, valueIfFalse.

public static IHtmlContent IsDescendant(this IPublishedContent content, IPublishedContent other, string valueIfTrue, string valueIfFalse)

Parameters

content IPublishedContent

The content.

other IPublishedContent

The other content.

valueIfTrue string

The value if true.

valueIfFalse string

The value if false.

Returns

IHtmlContent

The HTML encoded value.

IsDescendantOrSelf(IPublishedContent, IPublishedContent, string)

public static IHtmlContent IsDescendantOrSelf(this IPublishedContent content, IPublishedContent other, string valueIfTrue)

Parameters

content IPublishedContent
other IPublishedContent
valueIfTrue string

Returns

IHtmlContent

IsDescendantOrSelf(IPublishedContent, IPublishedContent, string, string)

If the specified content is a decendant of other or are the same, the HTML encoded valueIfTrue will be returned; otherwise, valueIfFalse.

public static IHtmlContent IsDescendantOrSelf(this IPublishedContent content, IPublishedContent other, string valueIfTrue, string valueIfFalse)

Parameters

content IPublishedContent

The content.

other IPublishedContent

The other content.

valueIfTrue string

The value if true.

valueIfFalse string

The value if false.

Returns

IHtmlContent

The HTML encoded value.

IsEqual(IPublishedContent, IPublishedContent, string)

If the specified content is equal to other, the HTML encoded valueIfTrue will be returned; otherwise, Empty.

public static IHtmlContent IsEqual(this IPublishedContent content, IPublishedContent other, string valueIfTrue)

Parameters

content IPublishedContent

The content.

other IPublishedContent

The other content.

valueIfTrue string

The value if true.

Returns

IHtmlContent

The HTML encoded value.

IsEqual(IPublishedContent, IPublishedContent, string, string)

If the specified content is equal to other, the HTML encoded valueIfTrue will be returned; otherwise, valueIfFalse.

public static IHtmlContent IsEqual(this IPublishedContent content, IPublishedContent other, string valueIfTrue, string valueIfFalse)

Parameters

content IPublishedContent

The content.

other IPublishedContent

The other content.

valueIfTrue string

The value if true.

valueIfFalse string

The value if false.

Returns

IHtmlContent

The HTML encoded value.

IsNotEqual(IPublishedContent, IPublishedContent, string)

If the specified content is not equal to other, the HTML encoded valueIfTrue will be returned; otherwise, Empty.

public static IHtmlContent IsNotEqual(this IPublishedContent content, IPublishedContent other, string valueIfTrue)

Parameters

content IPublishedContent

The content.

other IPublishedContent

The other content.

valueIfTrue string

The value if true.

Returns

IHtmlContent

The HTML encoded value.

IsNotEqual(IPublishedContent, IPublishedContent, string, string)

If the specified content is not equal to other, the HTML encoded valueIfTrue will be returned; otherwise, valueIfFalse.

public static IHtmlContent IsNotEqual(this IPublishedContent content, IPublishedContent other, string valueIfTrue, string valueIfFalse)

Parameters

content IPublishedContent

The content.

other IPublishedContent

The other content.

valueIfTrue string

The value if true.

valueIfFalse string

The value if false.

Returns

IHtmlContent

The HTML encoded value.

SearchChildren(IPublishedContent, IExamineManager, IUmbracoContextAccessor, string, string?)

public static IEnumerable<PublishedSearchResult> SearchChildren(this IPublishedContent content, IExamineManager examineManager, IUmbracoContextAccessor umbracoContextAccessor, string term, string? indexName = null)

Parameters

content IPublishedContent
examineManager IExamineManager
umbracoContextAccessor IUmbracoContextAccessor
term string
indexName string

Returns

IEnumerable<PublishedSearchResult>

SearchDescendants(IPublishedContent, IExamineManager, IUmbracoContextAccessor, string, string?)

public static IEnumerable<PublishedSearchResult> SearchDescendants(this IPublishedContent content, IExamineManager examineManager, IUmbracoContextAccessor umbracoContextAccessor, string term, string? indexName = null)

Parameters

content IPublishedContent
examineManager IExamineManager
umbracoContextAccessor IUmbracoContextAccessor
term string
indexName string

Returns

IEnumerable<PublishedSearchResult>

WriterName(IPublishedContent, IUserService)

Gets the name of the content item writer.

public static string? WriterName(this IPublishedContent content, IUserService userService)

Parameters

content IPublishedContent

The content item.

userService IUserService

Returns

string