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
IPublishedContentThe content item.
userService
IUserService
Returns
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
IPublishedContentThe document.
umbracoContextAccessor
IUmbracoContextAccessorsiteDomainHelper
ISiteDomainMappercurrent
UriAn 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
IPublishedContentother
IPublishedContentvalueIfTrue
string
Returns
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
IPublishedContentThe content.
other
IPublishedContentThe other content.
valueIfTrue
stringThe value if
true
.valueIfFalse
stringThe 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
IPublishedContentother
IPublishedContentvalueIfTrue
string
Returns
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
IPublishedContentThe content.
other
IPublishedContentThe other content.
valueIfTrue
stringThe value if
true
.valueIfFalse
stringThe 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
IPublishedContentThe content.
other
IPublishedContentThe other content.
valueIfTrue
stringThe 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
IPublishedContentThe content.
other
IPublishedContentThe other content.
valueIfTrue
stringThe value if
true
.valueIfFalse
stringThe 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
IPublishedContentother
IPublishedContentvalueIfTrue
string
Returns
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
IPublishedContentThe content.
other
IPublishedContentThe other content.
valueIfTrue
stringThe value if
true
.valueIfFalse
stringThe 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
IPublishedContentThe content.
other
IPublishedContentThe other content.
valueIfTrue
stringThe 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
IPublishedContentThe content.
other
IPublishedContentThe other content.
valueIfTrue
stringThe value if
true
.valueIfFalse
stringThe 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
IPublishedContentThe content.
other
IPublishedContentThe other content.
valueIfTrue
stringThe 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
IPublishedContentThe content.
other
IPublishedContentThe other content.
valueIfTrue
stringThe value if
true
.valueIfFalse
stringThe 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
IPublishedContentexamineManager
IExamineManagerumbracoContextAccessor
IUmbracoContextAccessorterm
stringindexName
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
IPublishedContentexamineManager
IExamineManagerumbracoContextAccessor
IUmbracoContextAccessorterm
stringindexName
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
IPublishedContentThe content item.
userService
IUserService