class ContextBlock implements BlockContract

Properties

protected string|null $blockId

A string acting as a unique identifier for a block.

protected ElementContract[] $elements

An array of image elements and text objects.

Methods

id(string $id)

Set the block identifier.

image(string $imageUrl, string|null $altText = null)

Add an image element to the block.

text(string $text)

Add a text element to the block.

array
toArray()

Get the instance as an array.

Details

at line 38
ContextBlock id(string $id)

Set the block identifier.

Parameters

string $id

Return Value

ContextBlock

at line 48
ImageElement image(string $imageUrl, string|null $altText = null)

Add an image element to the block.

Parameters

string $imageUrl
string|null $altText

Return Value

ImageElement

at line 58
TextObject text(string $text)

Add a text element to the block.

Parameters

string $text

Return Value

TextObject

at line 68
array toArray()

Get the instance as an array.

Return Value

array