eZ Publish Community Project (Legacy Stack) 2013.4
Class

ezpContentFieldSet

class ezpContentFieldSet implements ArrayAccess, Iterator

Allows for reading/writing of content fields (attributes) through an array like interface.

This class is aimed at being used through an ezpContent object, and usage examples can be found there.

Methods

__construct()

Initializes the fields set with a content object + language

static ezpContentFieldSet fromContentObject(eZContentObject $contentObject)

Initializes a level one ezpContentFieldSet from an eZContentObject

static ezpContentFieldSet fromDataMap(array $dataMap)

Initializes a level two ezpContentFieldSet from a content object data map

offsetExists($offset)

Array exists handler.

offsetSet($offset, $value)

Array set hander.

ezpContentFieldSet offsetGet($offset)

Array get handler.

offsetUnset($offset)

Unset array handler.

__set($name, eZContentObjectAttribute $value)

Setter.

mixed __get($name)

Getter.

__isset($name)

Used to check if an attribute has content: if ( isset( $content->fields->title ) ) <= no title

key()

Iterator::key()

current()

Iterator::current()

next()

Iterator::next()

rewind()

Iterator::rewind()

valid()

Iterator::valid()

void setActiveLanguage(string $language)

Sets the currently active language when reading attribute(/object/node) properties

Details

at line 24
public __construct()

Initializes the fields set with a content object + language

at line 33
static public ezpContentFieldSet fromContentObject(eZContentObject $contentObject)

Initializes a level one ezpContentFieldSet from an eZContentObject

Parameters

eZContentObject $contentObject

Return Value

ezpContentFieldSet

at line 55
static public ezpContentFieldSet fromDataMap(array $dataMap)

Initializes a level two ezpContentFieldSet from a content object data map

Parameters

array $dataMap

Return Value

ezpContentFieldSet

at line 72
public offsetExists($offset)

Array exists handler.

Can be used to check for existence of a language

Again, this operation might not belong to the fields set (data map) but to the content itself

Parameters

$offset

at line 85
public offsetSet($offset, $value)

Array set hander.

Will set the requested language's ezpFieldSet. Is that any good ? Might be used to enable a language on a content item: $article->fields['fre-FR'] = true Semantically speaking, this belongs to the content, not the fields. Maybe no need to implement that.

Parameters

$offset
$value

at line 95
public ezpContentFieldSet offsetGet($offset)

Array get handler.

Will return the requested language's ezpFieldSet

Parameters

$offset

Return Value

ezpContentFieldSet

at line 113
public offsetUnset($offset)

Unset array handler.

Should we allow a user to remove a language by using that syntax: unset( $content->fields['eng-GB'] );

Parameters

$offset

at line 120
public __set($name, eZContentObjectAttribute $value)

Setter.

Used to set attributes values.

Parameters

$name
eZContentObjectAttribute $value

at line 136
public mixed __get($name)

Getter.

Used to get attributes values.

Parameters

$name

Return Value

mixed

at line 163
public __isset($name)

Used to check if an attribute has content: if ( isset( $content->fields->title ) ) <= no title

Parameters

$name

See also

ezContentObjectAttribute->hasContent()

at line 186
public key()

Iterator::key()

at line 194
public current()

Iterator::current()

at line 202
public next()

Iterator::next()

at line 210
public rewind()

Iterator::rewind()

at line 218
public valid()

Iterator::valid()

at line 246
public void setActiveLanguage(string $language)

Sets the currently active language when reading attribute(/object/node) properties

Parameters

string $language Language locale (xxx-XX)

Return Value

void