1 | <?php |
||
21 | abstract class Content extends ValueObject |
||
22 | { |
||
23 | /** |
||
24 | * Returns the VersionInfo for this version. |
||
25 | * |
||
26 | * @return \eZ\Publish\API\Repository\Values\Content\VersionInfo |
||
27 | */ |
||
28 | abstract public function getVersionInfo(); |
||
29 | |||
30 | /** |
||
31 | * Shorthand method for getVersionInfo()->getName(). |
||
32 | * |
||
33 | * @see \eZ\Publish\API\Repository\Values\Content\VersionInfo::getName() |
||
34 | * |
||
35 | * @param string|null $languageCode |
||
36 | * |
||
37 | * @return string|null The name for a given language, or null if $languageCode is not set |
||
38 | * or does not exist. |
||
39 | */ |
||
40 | public function getName($languageCode = null) |
||
44 | |||
45 | /** |
||
46 | * Returns a field value for the given value. |
||
47 | * |
||
48 | * - If $languageCode is defined, |
||
49 | * return if available, otherwise null |
||
50 | * - If not pick using the following languages codes when applicable: |
||
51 | * 1. Prioritized languages (if provided to api on object retrieval) |
||
52 | * 2. Main language |
||
53 | * |
||
54 | * On non translatable fields this method ignores the languageCode parameter, and return main language field value. |
||
55 | * |
||
56 | * @param string $fieldDefIdentifier |
||
57 | * @param string $languageCode |
||
58 | * |
||
59 | * @return \eZ\Publish\SPI\FieldType\Value|null a primitive type or a field type Value object depending on the field type. |
||
60 | */ |
||
61 | abstract public function getFieldValue($fieldDefIdentifier, $languageCode = null); |
||
62 | |||
63 | /** |
||
64 | * This method returns the complete fields collection. |
||
65 | * |
||
66 | * @return \eZ\Publish\API\Repository\Values\Content\Field[] An array of {@link Field} |
||
67 | */ |
||
68 | abstract public function getFields(); |
||
69 | |||
70 | /** |
||
71 | * This method returns the fields for a given language and non translatable fields. |
||
72 | * |
||
73 | * - If $languageCode is defined, return if available |
||
74 | * - If not pick using prioritized languages (if provided to api on object retrieval) |
||
75 | * - Otherwise return in main language |
||
76 | * |
||
77 | * @param string $languageCode |
||
78 | * |
||
79 | * @return \eZ\Publish\API\Repository\Values\Content\Field[] An array of {@link Field} with field identifier as keys |
||
80 | */ |
||
81 | abstract public function getFieldsByLanguage($languageCode = null); |
||
82 | |||
83 | /** |
||
84 | * This method returns the field for a given field definition identifier and language. |
||
85 | * |
||
86 | * - If $languageCode is defined, |
||
87 | * return if available, otherwise null |
||
88 | * - If not pick using the following languages codes when applicable: |
||
89 | * 1. Prioritized languages (if provided to api on object retrieval) |
||
90 | * 2. Main language |
||
91 | * |
||
92 | * On non translatable fields this method ignores the languageCode parameter, and return main language field. |
||
93 | * |
||
94 | * @param string $fieldDefIdentifier |
||
95 | * @param string|null $languageCode |
||
96 | * |
||
97 | * @return \eZ\Publish\API\Repository\Values\Content\Field|null A {@link Field} or null if nothing is found |
||
98 | */ |
||
99 | abstract public function getField($fieldDefIdentifier, $languageCode = null); |
||
100 | } |
||
101 |