TemplateBlock

Class.

use Saij\WpAppFramework\Block\TemplateBlock;

A block with attributes and inner blocks, used in #[InnerBlocks(template, defaultBlock)], #[Example] and #[Variation].

Constructor

new TemplateBlock(CoreBlock|string $block, array $attributes = [], array $innerBlocks = [])
ParameterTypeDefaultDescription
blockclass-string|CoreBlock|stringrequiredA block class of the same theme or plugin, a core block or the full name of another block, e.g. "acme/slider".
attributesarray<string, mixed>[]Attribute values; backed enums stand for their value.
innerBlockslist<TemplateBlock>[]Inner blocks, for a container block.

Methods

getAttributes()

getAttributes(): array

The attribute values by attribute name.

Returns array<string, mixed>

getBlock()

getBlock(): CoreBlock|string

The block: a block class, a core block or the full name of another block.

Returns class-string|CoreBlock|string

getInnerBlocks()

getInnerBlocks(): array

The inner blocks.

Returns list<TemplateBlock>