View Source
Class ContentExtensions
Inheritance
System.Object
Assembly: Umbraco.Core.dll
Syntax
public static class ContentExtensions
Methods
View Source
GetAncestorIds(IContent)
Gets a collection containing the ids of all ancestors.
Declaration
public static IEnumerable<int>? GetAncestorIds(this IContent content)
Parameters
Returns
Type |
Description |
System.Nullable<IEnumerable<System.Int32>> |
An Enumerable list of integer ids
|
View Source
GetCreatorProfile(IContentBase, IUserService)
Gets the IProfile for the Creator of this content item.
Declaration
public static IProfile GetCreatorProfile(this IContentBase content, IUserService userService)
Parameters
Returns
View Source
GetCreatorProfile(IMedia, IUserService)
Gets the IProfile for the Creator of this media item.
Declaration
public static IProfile GetCreatorProfile(this IMedia media, IUserService userService)
Parameters
Returns
View Source
GetDirtyUserProperties(IContentBase)
Declaration
public static IEnumerable<string> GetDirtyUserProperties(this IContentBase entity)
Parameters
Returns
Type |
Description |
IEnumerable<System.String> |
|
View Source
GetNonGroupedProperties(IContentBase)
Returns properties that do not belong to a group
Declaration
public static IEnumerable<IProperty> GetNonGroupedProperties(this IContentBase content)
Parameters
Returns
View Source
GetPropertiesByEditor(IContentBase, String)
Returns all properties based on the editorAlias
Declaration
public static IEnumerable<IProperty> GetPropertiesByEditor(this IContentBase content, string editorAlias)
Parameters
Type |
Name |
Description |
IContentBase |
content |
|
System.String |
editorAlias |
|
Returns
View Source
GetPropertiesForGroup(IContentBase, PropertyGroup)
Returns the Property object for the given property group
Declaration
public static IEnumerable<IProperty> GetPropertiesForGroup(this IContentBase content, PropertyGroup propertyGroup)
Parameters
Returns
View Source
GetStatus(IContent, ContentScheduleCollection, String)
Gets the current status of the Content
Declaration
public static ContentStatus GetStatus(this IContent content, ContentScheduleCollection contentSchedule, string culture = null)
Parameters
Returns
View Source
GetWriterProfile(IContent, IUserService)
Gets the IProfile for the Writer of this content.
Declaration
public static IProfile GetWriterProfile(this IContent content, IUserService userService)
Parameters
Returns
View Source
GetWriterProfile(IMedia, IUserService)
Gets the IProfile for the Writer of this content.
Declaration
public static IProfile GetWriterProfile(this IMedia content, IUserService userService)
Parameters
Returns
View Source
IsAnyUserPropertyDirty(IContentBase)
Declaration
public static bool IsAnyUserPropertyDirty(this IContentBase entity)
Parameters
Returns
Type |
Description |
System.Boolean |
|
View Source
IsMoving(IContentBase)
Declaration
public static bool IsMoving(this IContentBase entity)
Parameters
Returns
Type |
Description |
System.Boolean |
|
View Source
SanitizeEntityPropertiesForXmlStorage(IContentBase)
Declaration
public static void SanitizeEntityPropertiesForXmlStorage(this IContentBase entity)
Parameters
View Source
SetValue(IContentBase, MediaFileManager, MediaUrlGeneratorCollection, IShortStringHelper, IContentTypeBaseServiceProvider, String, String, Stream, String, String)
Sets the posted file value of a property.
Declaration
public static void SetValue(this IContentBase content, MediaFileManager mediaFileManager, MediaUrlGeneratorCollection mediaUrlGenerators, IShortStringHelper shortStringHelper, IContentTypeBaseServiceProvider contentTypeBaseServiceProvider, string propertyTypeAlias, string filename, Stream filestream, string culture = null, string segment = null)
Parameters
View Source
StoreFile(IContentBase, MediaFileManager, IContentTypeBaseServiceProvider, String, String, Stream, String)
Declaration
public static string StoreFile(this IContentBase content, MediaFileManager mediaFileManager, IContentTypeBaseServiceProvider contentTypeBaseServiceProvider, string propertyTypeAlias, string filename, Stream filestream, string filepath)
Parameters
Type |
Name |
Description |
IContentBase |
content |
IContentBaseA content item.
|
MediaFileManager |
mediaFileManager |
The media file manager.
|
IContentTypeBaseServiceProvider |
contentTypeBaseServiceProvider |
The content type base service provider.
|
System.String |
propertyTypeAlias |
The property alias.
|
System.String |
filename |
The name of the file.
|
Stream |
filestream |
A stream containing the file data.
|
System.String |
filepath |
The original file path, if any.
|
Returns
Type |
Description |
System.String |
The path to the file, relative to the media filesystem.
|
View Source
ToDeepXml(IContent, IEntityXmlSerializer)
Creates the full xml representation for the IContent object and all of it's descendants
Declaration
public static XElement ToDeepXml(this IContent content, IEntityXmlSerializer serializer)
Parameters
Returns
Type |
Description |
System.Xml.Linq.XElement |
Xml representation of the passed in IContent
|
View Source
ToXml(IContent, IEntityXmlSerializer)
Creates the xml representation for the IContent object
Declaration
public static XElement ToXml(this IContent content, IEntityXmlSerializer serializer)
Parameters
Returns
Type |
Description |
System.Xml.Linq.XElement |
Xml representation of the passed in IContent
|
View Source
ToXml(IMedia, IEntityXmlSerializer)
Creates the xml representation for the IMedia object
Declaration
public static XElement ToXml(this IMedia media, IEntityXmlSerializer serializer)
Parameters
Returns
Type |
Description |
System.Xml.Linq.XElement |
Xml representation of the passed in IContent
|
View Source
ToXml(IMember, IEntityXmlSerializer)
Creates the xml representation for the IMember object
Declaration
public static XElement ToXml(this IMember member, IEntityXmlSerializer serializer)
Parameters
Returns
Type |
Description |
System.Xml.Linq.XElement |
Xml representation of the passed in IContent
|
View Source
TryGetMediaPath(IContentBase, String, MediaUrlGeneratorCollection, out String, String, String)
Returns the path to a media item stored in a property if the property editor is IMediaUrlGenerator
Declaration
public static bool TryGetMediaPath(this IContentBase content, string propertyTypeAlias, MediaUrlGeneratorCollection mediaUrlGenerators, out string mediaFilePath, string culture = null, string segment = null)
Parameters
Returns
Type |
Description |
System.Boolean |
True if the file path can be resolved and the property is IMediaUrlGenerator
|
View Source
WasAnyUserPropertyDirty(IContentBase)
Declaration
public static bool WasAnyUserPropertyDirty(this IContentBase entity)
Parameters
Returns
Type |
Description |
System.Boolean |
|