forked from ezsystems/ezpublish-api
/
ContentType.php
196 lines (173 loc) · 6.45 KB
/
ContentType.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
<?php
/**
* File containing the eZ\Publish\API\Repository\Values\ContentType\ContentType class.
*
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
namespace eZ\Publish\API\Repository\Values\ContentType;
use eZ\Publish\API\Repository\Values\ValueObject;
use eZ\Publish\SPI\Repository\Values\MultiLanguageName;
use eZ\Publish\SPI\Repository\Values\MultiLanguageDescription;
/**
* this class represents a content type value.
*
* @property-read \eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroup[] $contentTypeGroups calls getContentTypeGroups
* @property-read \eZ\Publish\API\Repository\Values\ContentType\FieldDefinition[] $fieldDefinitions calls getFieldDefinitions() or on access getFieldDefinition($fieldDefIdentifier)
* @property-read mixed $id the id of the content type
* @property-read int $status the status of the content type. One of ContentType::STATUS_DEFINED|ContentType::STATUS_DRAFT|ContentType::STATUS_MODIFIED
* @property-read string $identifier the identifier of the content type
* @property-read \DateTime $creationDate the date of the creation of this content type
* @property-read \DateTime $modificationDate the date of the last modification of this content type
* @property-read mixed $creatorId the user id of the creator of this content type
* @property-read mixed $modifierId the user id of the user which has last modified this content type
* @property-read string $remoteId a global unique id of the content object
* @property-read string $urlAliasSchema URL alias schema. If nothing is provided, $nameSchema will be used instead.
* @property-read string $nameSchema The name schema.
* @property-read bool $isContainer This flag hints to UIs if type may have children or not.
* @property-read string $mainLanguageCode the main language of the content type names and description used for fallback.
* @property-read bool $defaultAlwaysAvailable if an instance of a content type is created the always available flag is set by default this this value.
* @property-read string[] $languageCodes array of language codes used by content type translations.
*
* @property-read int $defaultSortField Specifies which property the child locations should be sorted on by default when created. Valid values are found at {@link Location::SORT_FIELD_*}
* @property-read int $defaultSortOrder Specifies whether the sort order should be ascending or descending by default when created. Valid values are {@link Location::SORT_ORDER_*}
*/
abstract class ContentType extends ValueObject implements MultiLanguageName, MultiLanguageDescription
{
/**
* @var int Status constant for defined (aka "published") Type
*/
const STATUS_DEFINED = 0;
/**
* @var int Status constant for draft (aka "temporary") Type
*/
const STATUS_DRAFT = 1;
/**
* @var int Status constant for modified (aka "deferred for publishing") Type
*/
const STATUS_MODIFIED = 2;
/**
* Content type ID.
*
* @var mixed
*/
protected $id;
/**
* The status of the content type.
*
* @var int One of Type::STATUS_DEFINED|Type::STATUS_DRAFT|Type::STATUS_MODIFIED
*/
protected $status;
/**
* String identifier of a content type.
*
* @var string
*/
protected $identifier;
/**
* Creation date of the content type.
*
* @var \DateTime
*/
protected $creationDate;
/**
* Modification date of the content type.
*
* @var \DateTime
*/
protected $modificationDate;
/**
* Creator user id of the content type.
*
* @var mixed
*/
protected $creatorId;
/**
* Modifier user id of the content type.
*
* @var mixed
*/
protected $modifierId;
/**
* Unique remote ID of the content type.
*
* @var string
*/
protected $remoteId;
/**
* URL alias schema.
*
* If nothing is provided, $nameSchema will be used instead.
*
* @var string
*/
protected $urlAliasSchema;
/**
* Name schema.
*
* Can be composed of FieldDefinition identifier place holders.
* These place holders must comply this pattern : <field_definition_identifier>.
* An OR condition can be used :
* <field_def|other_field_def>
* In this example, field_def will be used if available. If not, other_field_def will be used for content name generation
*
* @var string
*/
protected $nameSchema;
/**
* A flag used to hint if content of this type may have children or not. It is highly recommended to respect this flag and not create/move content below non-containers.
* But this flag is not considered as part of the content model and the API will not in any way enforce this flag to be respected.
*
* @var bool
*/
protected $isContainer;
/**
* If an instance of a content type is created the always available flag is set
* by default to this value.
*
* @var bool
*/
protected $defaultAlwaysAvailable = true;
/**
* Specifies which property the child locations should be sorted on by default when created.
*
* Valid values are found at {@link Location::SORT_FIELD_*}
*
* @var int
*/
protected $defaultSortField;
/**
* Specifies whether the sort order should be ascending or descending by default when created.
*
* Valid values are {@link Location::SORT_ORDER_*}
*
* @var int
*/
protected $defaultSortOrder;
/**
* List of language codes used by translations.
*
* @var string[]
*/
protected $languageCodes;
/**
* This method returns the content type groups this content type is assigned to.
*
* @return \eZ\Publish\API\Repository\Values\ContentType\ContentTypeGroup[]
*/
abstract public function getContentTypeGroups();
/**
* This method returns the content type field definitions from this type.
*
* @return \eZ\Publish\API\Repository\Values\ContentType\FieldDefinition[]
*/
abstract public function getFieldDefinitions();
/**
* This method returns the field definition for the given identifier.
*
* @param string $fieldDefinitionIdentifier
*
* @return \eZ\Publish\API\Repository\Values\ContentType\FieldDefinition
*/
abstract public function getFieldDefinition($fieldDefinitionIdentifier);
}