Table of Contents

Class ContentTypeControllerBase<TContentType>

Namespace
Umbraco.Cms.Web.BackOffice.Controllers
Assembly
Umbraco.Web.BackOffice.dll

Am abstract API controller providing functionality used for dealing with content and media types

[PrefixlessBodyModelValidator]
public abstract class ContentTypeControllerBase<TContentType> : BackOfficeNotificationsController where TContentType : class, IContentTypeComposition

Type Parameters

TContentType
Inheritance
ContentTypeControllerBase<TContentType>
Derived
Inherited Members

Constructors

ContentTypeControllerBase(ICultureDictionary, EditorValidatorCollection, IContentTypeService, IMediaTypeService, IMemberTypeService, IUmbracoMapper, ILocalizedTextService)

protected ContentTypeControllerBase(ICultureDictionary cultureDictionary, EditorValidatorCollection editorValidatorCollection, IContentTypeService contentTypeService, IMediaTypeService mediaTypeService, IMemberTypeService memberTypeService, IUmbracoMapper umbracoMapper, ILocalizedTextService localizedTextService)

Parameters

cultureDictionary ICultureDictionary
editorValidatorCollection EditorValidatorCollection
contentTypeService IContentTypeService
mediaTypeService IMediaTypeService
memberTypeService IMemberTypeService
umbracoMapper IUmbracoMapper
localizedTextService ILocalizedTextService

Properties

ContentTypeService

public IContentTypeService ContentTypeService { get; }

Property Value

IContentTypeService

CultureDictionary

protected ICultureDictionary CultureDictionary { get; }

Property Value

ICultureDictionary

LocalizedTextService

public ILocalizedTextService LocalizedTextService { get; }

Property Value

ILocalizedTextService

MediaTypeService

public IMediaTypeService MediaTypeService { get; }

Property Value

IMediaTypeService

MemberTypeService

public IMemberTypeService MemberTypeService { get; }

Property Value

IMemberTypeService

UmbracoMapper

public IUmbracoMapper UmbracoMapper { get; }

Property Value

IUmbracoMapper

Methods

GetContentTypeService<T>()

public IContentTypeBaseService<T>? GetContentTypeService<T>() where T : IContentTypeComposition

Returns

IContentTypeBaseService<T>

Type Parameters

T

PerformCopy(MoveOrCopy, Func<int, TContentType?>, Func<TContentType, int, Attempt<OperationResult<MoveOperationStatusType, TContentType>>>)

Move

protected IActionResult PerformCopy(MoveOrCopy move, Func<int, TContentType?> getContentType, Func<TContentType, int, Attempt<OperationResult<MoveOperationStatusType, TContentType>>> doCopy)

Parameters

move MoveOrCopy
getContentType Func<int, TContentType>
doCopy Func<TContentType, int, Attempt<OperationResult<MoveOperationStatusType, TContentType>>>

Returns

IActionResult

PerformGetAvailableCompositeContentTypes(int, UmbracoObjectTypes, string[]?, string[]?, bool)

Returns the available composite content types for a given content type

protected ActionResult<IEnumerable<Tuple<EntityBasic?, bool>>> PerformGetAvailableCompositeContentTypes(int contentTypeId, UmbracoObjectTypes type, string[]? filterContentTypes, string[]? filterPropertyTypes, bool isElement)

Parameters

contentTypeId int
type UmbracoObjectTypes
filterContentTypes string[]

This is normally an empty list but if additional content type aliases are passed in, any content types containing those aliases will be filtered out along with any content types that have matching property types that are included in the filtered content types

filterPropertyTypes string[]

This is normally an empty list but if additional property type aliases are passed in, any content types that have these aliases will be filtered out. This is required because in the case of creating/modifying a content type because new property types being added to it are not yet persisted so cannot be looked up via the db, they need to be passed in.

isElement bool

Whether the composite content types should be applicable for an element type

Returns

ActionResult<IEnumerable<Tuple<EntityBasic, bool>>>

PerformGetWhereCompositionIsUsedInContentTypes(int, UmbracoObjectTypes)

Returns a list of content types where a particular composition content type is used

protected ActionResult<IEnumerable<EntityBasic>> PerformGetWhereCompositionIsUsedInContentTypes(int contentTypeId, UmbracoObjectTypes type)

Parameters

contentTypeId int

Id of composition content type

type UmbracoObjectTypes

Type of content Type, eg documentType or mediaType

Returns

ActionResult<IEnumerable<EntityBasic>>

PerformMove(MoveOrCopy, Func<int, TContentType?>, Func<TContentType, int, Attempt<OperationResult<MoveOperationStatusType>>>)

Move

protected IActionResult PerformMove(MoveOrCopy move, Func<int, TContentType?> getContentType, Func<TContentType, int, Attempt<OperationResult<MoveOperationStatusType>>> doMove)

Parameters

move MoveOrCopy
getContentType Func<int, TContentType>
doMove Func<TContentType, int, Attempt<OperationResult<MoveOperationStatusType>>>

Returns

IActionResult

PerformPostSave<TContentTypeDisplay, TContentTypeSave, TPropertyType>(TContentTypeSave, Func<int, TContentType?>, Action<TContentType?>, Action<TContentTypeSave>?)

protected ActionResult<TContentType?> PerformPostSave<TContentTypeDisplay, TContentTypeSave, TPropertyType>(TContentTypeSave contentTypeSave, Func<int, TContentType?> getContentType, Action<TContentType?> saveContentType, Action<TContentTypeSave>? beforeCreateNew = null) where TContentTypeDisplay : ContentTypeCompositionDisplay where TContentTypeSave : ContentTypeSave<TPropertyType> where TPropertyType : PropertyTypeBasic

Parameters

contentTypeSave TContentTypeSave
getContentType Func<int, TContentType>
saveContentType Action<TContentType>
beforeCreateNew Action<TContentTypeSave>

Returns

ActionResult<TContentType>

Type Parameters

TContentTypeDisplay
TContentTypeSave
TPropertyType

TranslateItem(string?)

protected string? TranslateItem(string? text)

Parameters

text string

Returns

string