#[Example]

Attribute on classes.

use Saij\WpAppFramework\Block\Example;

The preview of a block in the inserter. Without this attribute the preview shows the block with its default attributes and, for a container, the template of #[InnerBlocks]; #[Example(false)] shows no preview.

Arguments

#[Example(array|false $attributes = [], array $innerBlocks = [], ?int $viewportWidth = null)]
ParameterTypeDefaultDescription
attributesarray<string, mixed>|false[]Attribute values (backed enums stand for their value); false for no preview.
innerBlockslist<TemplateBlock>[]Inner blocks of the preview, for a container block.
viewportWidthint|nullnullWidth in pixels the preview is rendered at (WordPress: 500).