class Extension extends BaseResource implements CreatableInterface

Extension class.

This class represents a resource with type "Extension" in Contentful.

Traits

DeletableTrait.
UpdatableTrait.

Properties

SystemProperties $sys from UpdatableTrait
Client $client from UpdatableTrait
protected string $name
protected string $source
protected FieldType[] $fieldTypes
protected bool $sidebar

Methods

initialize(string $type, array $sys = [])

Initialize system properties.

getSystemProperties()

{@inheritdoc}

getId()

{@inheritdoc}

getType()

{@inheritdoc}

asLink()

{@inheritdoc}

mixed
asRequestBody()

Returns the resource in the form of request body.

setClient(Client $client)

Sets the current Client object instance.

void
delete()

No description

void
update()

No description

__construct(string $name = '')

Extension construct.

string[]
asUriParameters()

Returns an associate array where keys are the name of the fragments in a URI, and the values are the corresponding IDs.

string[]
getHeadersForCreation()

Returns an array of headers that the current resource needs to sent for being created.

string
getName()

No description

setName(string $name)

No description

string
getSource()

No description

setSource(string $source)

No description

getFieldTypes()

No description

setFieldTypes(array $fieldTypes)

No description

addFieldType(FieldType $fieldType)

No description

addNewFieldType(string $type, array $options = [])

Shortcut for adding a new field type.

bool
isSidebar()

No description

setSidebar(bool $sidebar)

No description

array
jsonSerialize()

Returns an array to be used by "json_encode" to serialize objects of this class.

Details

in BaseResource at line 39
protected initialize(string $type, array $sys = [])

Initialize system properties.

Parameters

string $type The system type
array $sys

in BaseResource at line 48
getSystemProperties()

{@inheritdoc}

in BaseResource at line 56
getId()

{@inheritdoc}

in BaseResource at line 64
getType()

{@inheritdoc}

{@inheritdoc}

in UpdatableTrait at line 33
abstract mixed asRequestBody()

Returns the resource in the form of request body.

This can differ from regular serialization, as some fields may not be present in the request payload.

Return Value

mixed

in BaseResource at line 98
BaseResource setClient(Client $client)

Sets the current Client object instance.

This is done automatically when performing API calls, so it shouldn't be used manually.

Parameters

Client $client

Return Value

BaseResource

at line 30
void delete()

Return Value

void

at line 30
void update()

Return Value

void

at line 60
__construct(string $name = '')

Extension construct.

Parameters

string $name

at line 69
string[] asUriParameters()

Returns an associate array where keys are the name of the fragments in a URI, and the values are the corresponding IDs.

Return Value

string[]

at line 81
string[] getHeadersForCreation()

Returns an array of headers that the current resource needs to sent for being created.

This method is supposed to be overridden if necessary.

Return Value

string[]

at line 89
string getName()

Return Value

string

at line 99
Extension setName(string $name)

Parameters

string $name

Return Value

Extension

at line 109
string getSource()

Return Value

string

at line 119
Extension setSource(string $source)

Parameters

string $source Either the full extension code, or an URL

Return Value

Extension

at line 129
FieldType[] getFieldTypes()

Return Value

FieldType[]

at line 139
Extension setFieldTypes(array $fieldTypes)

Parameters

array $fieldTypes

Return Value

Extension

at line 153
Extension addFieldType(FieldType $fieldType)

Parameters

FieldType $fieldType

Return Value

Extension

at line 168
Extension addNewFieldType(string $type, array $options = [])

Shortcut for adding a new field type.

Parameters

string $type
array $options

Return Value

Extension

at line 176
bool isSidebar()

Return Value

bool

at line 186
Extension setSidebar(bool $sidebar)

Parameters

bool $sidebar

Return Value

Extension

at line 198
array jsonSerialize()

Returns an array to be used by "json_encode" to serialize objects of this class.

Return Value

array