class ContentItem implements ContentItemInterface

Content item

Properties

protected array $data Content data
protected ContentTypeInterface $type Content item type
protected string $id Content item id

Methods

__construct(array $data, ContentTypeInterface $type, string $id)

Constructor

boolean
__isset(string $name)

True if field exist

mixed
__get(string $name)

Get field value

getType()

Get content type

void
runAction(string $name, array|null $options = [])

Run action

static mixed
create(array $data, ContentTypeInterface $type, string $id)

Create content item

array
actions()

Get actions

array
fields()

Get fields

mixed
getValue(string $fieldName, mixed $default = null)

Get field value

FieldInterface|null
field(string $fieldName)

Get content field

void
setValue(string $fieldName, mixed $value)

Set field value

int|string
getId()

Get content item id

array
toArray()

To array

Details

at line 50
__construct(array $data, ContentTypeInterface $type, string $id)

Constructor

Parameters

array $data
ContentTypeInterface $type
string $id

at line 63
boolean __isset(string $name)

True if field exist

Parameters

string $name

Return Value

boolean

at line 74
mixed __get(string $name)

Get field value

Parameters

string $name

Return Value

mixed

at line 84
ContentTypeInterface getType()

Get content type

Return Value

ContentTypeInterface

at line 96
void runAction(string $name, array|null $options = [])

Run action

Parameters

string $name
array|null $options

Return Value

void

at line 114
static mixed create(array $data, ContentTypeInterface $type, string $id)

Create content item

Parameters

array $data
ContentTypeInterface $type
string $id

Return Value

mixed

at line 124
array actions()

Get actions

Return Value

array

at line 134
array fields()

Get fields

Return Value

array

at line 154
mixed getValue(string $fieldName, mixed $default = null)

Get field value

Parameters

string $fieldName
mixed $default

Return Value

mixed

at line 170
FieldInterface|null field(string $fieldName)

Get content field

Parameters

string $fieldName

Return Value

FieldInterface|null

at line 189
void setValue(string $fieldName, mixed $value)

Set field value

Parameters

string $fieldName
mixed $value

Return Value

void

at line 199
int|string getId()

Get content item id

Return Value

int|string

at line 209
array toArray()

To array

Return Value

array