ContentTypeService
Methods¶
addFieldDefinition()
¶
Adds a new field definition to an existing content type.
|
|
The content type must be in state DRAFT.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$contentTypeDraft | ContentTypeDraft | - | - |
$fieldDefinitionCreateStruct | FieldDefinitionCreateStruct | - | - |
Tags
assignContentTypeGroup()
¶
Assigns a content type to a content type group.
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$contentType | ContentType | - | - |
$contentTypeGroup | ContentTypeGroup | - | - |
Tags
copyContentType()
¶
Copy Type incl fields and groupIds to a new Type object.
|
|
New Type will have $creator as creator / modifier, created / modified should be updated with current time, updated remoteId and identifier should be appended with '_' + unique string.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$contentType | ContentType | - | - |
$creator | User | null |
If null the current-user is used instead |
Return values
Tags
createContentType()
¶
Create a content type object.
|
|
The content type is created in the state STATUS_DRAFT.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$contentTypeCreateStruct | ContentTypeCreateStruct | - | - |
$contentTypeGroups | array<string|int, ContentTypeGroup> | - |
Required array of ContentTypeGroup to link type with (must contain one) |
Return values
Tags
createContentTypeDraft()
¶
Creates a draft from an existing content type.
|
|
This is a complete copy of the content type which has the state STATUS_DRAFT.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$contentType | ContentType | - | - |
Return values
Tags
createContentTypeGroup()
¶
Create a content type group object.
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$contentTypeGroupCreateStruct | ContentTypeGroupCreateStruct | - | - |
Return values
Tags
deleteContentType()
¶
Delete a content type object.
|
|
Deletes a content type if it has no instances. If content type in state STATUS_DRAFT is given, only the draft content type will be deleted. Otherwise, if content type in state STATUS_DEFINED is given, all content type data will be deleted.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$contentType | ContentType | - | - |
Tags
deleteContentTypeGroup()
¶
Delete a content type group.
|
|
This method only deletes an content type group which has content types without any content instances
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$contentTypeGroup | ContentTypeGroup | - | - |
Tags
deleteUserDrafts()
¶
Delete all content type drafs created or modified by the user.
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$userId | int | - | - |
isContentTypeUsed()
¶
Returns true if the given content type $contentType has content instances.
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$contentType | ContentType | - | - |
Return values
bool
loadContentType()
¶
Get a content type object by id.
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$contentTypeId | int | - | - |
$prioritizedLanguages | array<string|int, string> | [] |
Used as prioritized language code on translated properties of returned object. |
Return values
Tags
loadContentTypeByIdentifier()
¶
Get a content type object by identifier.
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$identifier | string | - | - |
$prioritizedLanguages | array<string|int, string> | [] |
Used as prioritized language code on translated properties of returned object. |
Return values
Tags
loadContentTypeByRemoteId()
¶
Get a content type object by id.
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$remoteId | string | - | - |
$prioritizedLanguages | array<string|int, string> | [] |
Used as prioritized language code on translated properties of returned object. |
Return values
Tags
loadContentTypeDraft()
¶
Get a content type object draft by id.
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$contentTypeId | int | - | - |
$ignoreOwnership | bool | false |
if true, method will return draft even if the owner is different than currently logged in user |
Return values
Tags
loadContentTypeGroup()
¶
Get a content type group object by id.
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$contentTypeGroupId | int | - | - |
$prioritizedLanguages | array<string|int, string> | [] |
Used as prioritized language code on translated properties of returned object. |
Return values
Tags
loadContentTypeGroupByIdentifier()
¶
Get a content type group object by identifier.
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$contentTypeGroupIdentifier | string | - | - |
$prioritizedLanguages | array<string|int, string> | [] |
Used as prioritized language code on translated properties of returned object. |
Return values
Tags
loadContentTypeGroups()
¶
Get all content type groups.
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$prioritizedLanguages | array<string|int, string> | [] |
Used as prioritized language code on translated properties of returned object. |
Return values
array<string|int, ContentTypeGroup>
loadContentTypeList()
¶
Bulk-load content type objects by ids.
|
|
Note: it does not throw exceptions on load, just ignores erroneous items.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$contentTypeIds | array<string|int, int> | - | - |
$prioritizedLanguages | array<string|int, string> | [] |
Used as prioritized language code on translated properties of returned object. |
Return values
array<string|int, ContentType>|iterable<string|int, mixed>
loadContentTypes()
¶
Get content type objects which belong to the given content type group.
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$contentTypeGroup | ContentTypeGroup | - | - |
$prioritizedLanguages | array<string|int, string> | [] |
Used as prioritized language code on translated properties of returned object. |
Return values
array<string|int, ContentType>
an array of ContentType which have status DEFINED
newContentTypeCreateStruct()
¶
Instantiates a new content type create class.
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$identifier | string | - | - |
Return values
newContentTypeGroupCreateStruct()
¶
Instantiates a new content type group create class.
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$identifier | string | - | - |
Return values
newContentTypeGroupUpdateStruct()
¶
Instantiates a new content type update struct.
|
|
Return values
newContentTypeUpdateStruct()
¶
Instantiates a new content type update struct.
|
|
Return values
newFieldDefinitionCreateStruct()
¶
Instantiates a field definition create struct.
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$identifier | string | - |
the required identifier for the field definition |
$fieldTypeIdentifier | string | - |
the required field type identifier |
Return values
newFieldDefinitionUpdateStruct()
¶
Instantiates a field definition update class.
|
|
Return values
publishContentTypeDraft()
¶
Publish the content type and update content objects.
|
|
This method updates content objects, depending on the changed field definitions.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$contentTypeDraft | ContentTypeDraft | - | - |
Tags
removeContentTypeTranslation()
¶
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$contentTypeDraft | ContentTypeDraft | - | - |
$languageCode | string | - | - |
Return values
removeFieldDefinition()
¶
Remove a field definition from an existing Type.
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$contentTypeDraft | ContentTypeDraft | - | - |
$fieldDefinition | FieldDefinition | - | - |
Tags
unassignContentTypeGroup()
¶
Unassign a content type from a group.
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$contentType | ContentType | - | - |
$contentTypeGroup | ContentTypeGroup | - | - |
Tags
updateContentTypeDraft()
¶
Update a content type object.
|
|
Does not update fields (fieldDefinitions), use ContentTypeService::updateFieldDefinition() to update them.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$contentTypeDraft | ContentTypeDraft | - | - |
$contentTypeUpdateStruct | ContentTypeUpdateStruct | - | - |
Tags
updateContentTypeGroup()
¶
Update a content type group object.
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$contentTypeGroup | ContentTypeGroup | - |
the content type group to be updated |
$contentTypeGroupUpdateStruct | ContentTypeGroupUpdateStruct | - | - |
Tags
updateFieldDefinition()
¶
Update a field definition.
|
|
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$contentTypeDraft | ContentTypeDraft | - |
the content type draft |
$fieldDefinition | FieldDefinition | - |
the field definition which should be updated |
$fieldDefinitionUpdateStruct | FieldDefinitionUpdateStruct | - | - |