Copied!

Content

Content.php : 24
Extends ValueObject

this class represents a content object in a specific version.

Properties

public $contentInfo read-only

Content.php
public ContentInfo $contentInfo

@deprecated 4.6.7 accessing magic getter is deprecated and will be removed in 5.0.0. Use Content::getContentInfo() instead.

public $fields read-only

Content.php
public array<string|int, Field$fields

access fields, calls getFields()

public $id read-only

Content.php
public int $id

@deprecated 4.6.7 accessing magic getter is deprecated and will be removed in 5.0.0. Use Content::getId() instead.

public $thumbnail read-only

Content.php
public Thumbnail|null $thumbnail

calls getThumbnail()

public $versionInfo read-only

Content.php
public VersionInfo $versionInfo

calls getVersionInfo()

Methods

public__construct()

ValueObject.php : 30

Construct object optionally with a set of properties.

public __construct([array<string|int, mixed> $properties = [] ])

Readonly properties values must be set using $properties as they are not writable anymore after object has been created.

Parameters

Name Type Default value Description
$properties array<string|int, mixed> [] -

publicgetContentInfo()

Content.php : 31
public getContentInfo() : ContentInfo

Return values

ContentInfo

publicgetContentType()

Content.php : 119

Returns the ContentType for this content.

public abstract getContentType() : ContentType

Return values

ContentType

publicgetDefaultLanguageCode()

Content.php : 123
public abstract getDefaultLanguageCode() : string

Return values

string

publicgetField()

Content.php : 112

This method returns the field for a given field definition identifier and language.

public abstract getField(string $fieldDefIdentifier[, string|null $languageCode = null ]) : Field|null
  • If $languageCode is defined, return if available, otherwise null
  • If not pick using the following languages codes when applicable:
    1. Prioritized languages (if provided to api on object retrieval)
    2. Main language

On non translatable fields this method ignores the languageCode parameter, and return main language field.

Parameters

Name Type Default value Description
$fieldDefIdentifier string - -
$languageCode string|null null -

Return values

Field|null

A Field or null if nothing is found

publicgetFields()

Content.php : 81

This method returns the complete fields collection.

public abstract getFields() : array<string|int, Field>

Return values

array<string|int, Field>

An array of Field

publicgetFieldsByLanguage()

Content.php : 94

This method returns the fields for a given language and non translatable fields.

public abstract getFieldsByLanguage([string|null $languageCode = null ]) : array<string|int, Field>
  • If $languageCode is defined, return if available
  • If not pick using prioritized languages (if provided to api on object retrieval)
  • Otherwise return in main language

Parameters

Name Type Default value Description
$languageCode string|null null -

Return values

array<string|int, Field>

An array of Field with field identifier as keys

publicgetFieldValue()

Content.php : 74

Returns a field value for the given value.

public abstract getFieldValue(string $fieldDefIdentifier[, string|null $languageCode = null ]) : Value|null
  • If $languageCode is defined, return if available, otherwise null
  • If not pick using the following languages codes when applicable:
    1. Prioritized languages (if provided to api on object retrieval)
    2. Main language

On non translatable fields this method ignores the languageCode parameter, and return main language field value.

Parameters

Name Type Default value Description
$fieldDefIdentifier string - -
$languageCode string|null null -

Return values

Value|null

a primitive type or a field type Value object depending on the field type.

publicgetId()

Content.php : 26
public getId() : int

Return values

int

publicgetName()

Content.php : 53

Shorthand method for getVersionInfo()->getName().

public getName([string|null $languageCode = null ]) : string|null

Parameters

Name Type Default value Description
$languageCode string|null null -

Return values

string|null

The name for a given language, or null if $languageCode is not set or does not exist.

publicgetThumbnail()

Content.php : 121
public abstract getThumbnail() : Thumbnail|null

Return values

Thumbnail|null

publicgetVersionInfo()

Content.php : 41

Returns the VersionInfo for this version.

public abstract getVersionInfo() : VersionInfo

Return values

VersionInfo

protectedgetProperties()

ValueObject.php : 50

Function where list of properties are returned.

protected getProperties([array<string|int, mixed> $dynamicProperties = [] ]) : array<string|int, mixed>

Used by attributes(), override to add dynamic properties

Parameters

Name Type Default value Description
$dynamicProperties array<string|int, mixed> []

Additional dynamic properties exposed on the object

Return values

array<string|int, mixed>