class Extension extends BaseResource implements CreatableInterface

Extension class.

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

Traits

DeletableTrait.
UpdatableTrait.

Properties

protected Extension $sys
Client $client from UpdatableTrait
protected string $name
protected string $source
protected FieldType[] $fieldTypes
protected bool $sidebar
protected Parameter[] $installationParameters
protected Parameter[] $instanceParameters

Methods

string
getId()

{@inheritdoc}

string
getType()

{@inheritdoc}

Link
asLink()

{@inheritdoc}

mixed
asRequestBody()

Returns the resource in the form of request body.

setClient(Client $client)

Sets the current Client object instance.

delete()

Deletes the current resource.

update()

Updates the current resource.

getSystemProperties()

{@inheritdoc}

__construct(string $name = '')

Extension construct.

array
asUriParameters()

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

array
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

array
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
getInstallationParameters()

No description

addInstallationParameter(Parameter $parameter)

No description

setInstallationParameters(Parameter[] $parameters = [])

No description

array
getInstanceParameters()

No description

addInstanceParameter(Parameter $parameter)

No description

setInstanceParameters(Parameter[] $parameters = [])

No description

array
jsonSerialize()

{@inheritdoc}

Details

in BaseResource at line 37
string getId()

{@inheritdoc}

Return Value

string

in BaseResource at line 45
string getType()

{@inheritdoc}

Return Value

string

{@inheritdoc}

Return Value

Link

in UpdatableTrait at line 35
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 79
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

in DeletableTrait at line 28
delete()

Deletes the current resource.

in UpdatableTrait at line 40
update()

Updates the current resource.

at line 82
Extension getSystemProperties()

{@inheritdoc}

Return Value

Extension

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

Extension construct.

Parameters

string $name

at line 90
array asUriParameters()

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

Return Value

array

at line 102
array 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

array

at line 110
string getName()

Return Value

string

at line 120
Extension setName(string $name)

Parameters

string $name

Return Value

Extension

at line 130
string getSource()

Return Value

string

at line 140
Extension setSource(string $source)

Parameters

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

Return Value

Extension

at line 150
array getFieldTypes()

Return Value

array

at line 160
Extension setFieldTypes(array $fieldTypes)

Parameters

array $fieldTypes

Return Value

Extension

at line 174
Extension addFieldType(FieldType $fieldType)

Parameters

FieldType $fieldType

Return Value

Extension

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

Shortcut for adding a new field type.

Parameters

string $type
array $options

Return Value

Extension

at line 197
bool isSidebar()

Return Value

bool

at line 207
Extension setSidebar(bool $sidebar)

Parameters

bool $sidebar

Return Value

Extension

at line 217
array getInstallationParameters()

Return Value

array

at line 227
Extension addInstallationParameter(Parameter $parameter)

Parameters

Parameter $parameter

Return Value

Extension

at line 239
Extension setInstallationParameters(Parameter[] $parameters = [])

Parameters

Parameter[] $parameters

Return Value

Extension

at line 249
array getInstanceParameters()

Return Value

array

at line 259
Extension addInstanceParameter(Parameter $parameter)

Parameters

Parameter $parameter

Return Value

Extension

at line 271
Extension setInstanceParameters(Parameter[] $parameters = [])

Parameters

Parameter[] $parameters

Return Value

Extension

at line 281
array jsonSerialize()

{@inheritdoc}

Return Value

array