Block final readonly class
Minn\Blocks\Block · public/minn/src/Minn/Blocks/Block.php · 63 lines
One parsed block. A null name is freeform HTML between blocks. The innerContent list holds the block's own HTML chunks in order, with a null placeholder wherever an inner block sits.
Used by 26 (show)
Constants and properties
| prop | readonly ?string $name | Promoted from the constructor. |
| prop | readonly array $attrs | Promoted from the constructor. |
| prop | readonly array $innerBlocks | Promoted from the constructor. |
| prop | readonly string $innerHtml | Promoted from the constructor. |
| prop | readonly array $innerContent | Promoted from the constructor. |
Public
| new | __construct(?string $name, array $attrs, array $innerBlocks, string $innerHtml, array $innerContent)# | ||||
| static | freeform(string $html): self# | A block-less run of HTML, as the parser reads it. | |||
| static | fromArray(array $block): self# | A block as parse_blocks hands it out, as the value object. @param array<string, mixed> $block
| |||
| method | withAttrs(array $attrs): self# | The same block with other attributes. @param array<string, mixed> $attrs
| |||
| method | toArray(): array# | The block as parse_blocks hands it to plugin code. @return array{blockName: ?string, attrs: array<string, mixed>, innerBlocks: list<array<string, mixed>>, innerHTML: string, innerContent: list<string|null>} | |||
| method | attr(string $key, mixed $default = NULL): mixed# | One attribute, or the default. | |||
| method | className(): string# | The class names declared on the block's own attributes (className). |
Nothing matches.