NamespaceSystemLibrary.Common.Episerver.Extensions
Common content reference extensions
ContentReferenceExtensions
public static class ContentReferenceExtensions
Inheritance
System.Object
ContentReferenceExtensions
Common content reference extensions
Returns true if the content reference is not null and has an ID larger than 0, else false
Type | Name | Description |
---|---|---|
EPiServer.Core.ContentReference | contentReference |
Type | Description |
---|---|
System.Boolean |
Returns true if the contentReference is null, or have an ID less than 1, else false
Type | Name | Description |
---|---|---|
EPiServer.Core.ContentReference | contentReference |
Type | Description |
---|---|
System.Boolean |
Convert content reference to content data of type T
T can be a block, page or media data
Returns content or null if not foundfilterByDisplayable: content cannot be deleted, it must be published, current user must have read access and code of the content type must exist
var articlePage = contentReference.To<ArticlePage>();
var textBlock = contentReference.To<TextBlock>();
Name | Description |
---|---|
T |
Type | Name | Description |
---|---|---|
EPiServer.Core.ContentReference | contentReference | |
System.Boolean | filterByDisplayable |
Type | Description |
---|---|
T |
Returns a friendly url behind the content reference, or null if content reference is null or has an invalid ID
Type | Name | Description |
---|---|---|
EPiServer.Core.ContentReference | contentReference | |
System.Nullable<System.Boolean> | convertToAbsolute |
Type | Description |
---|---|
System.String |
}