Blocks
Overview
The Blocks module wraps block registration and block-style registration with fluent builders for attributes and supports. It is designed for server-side configuration of Gutenberg blocks.
Types in this module
Lipe\Lib\Blocks\AttributesLipe\Lib\Blocks\Register_BlockLipe\Lib\Blocks\Register_Block_StyleLipe\Lib\Blocks\Args\PropLipe\Lib\Blocks\Args\SourceLipe\Lib\Blocks\Args\Supports
Classes using Lipe\Lib\Args\Args also expose public function __construct(array $existing), public function merge(ArgsRules $overrides): void, and public function get_args(): array.
Attributes
Builds the attributes array for register_block_type().
Key public methods
public function prop(string $name): Proppublic function get_args(): array
Register_Block
Fluent wrapper around register_block_type().
Key public methods
public function supports(): Supports
Example
<?php
use Lipe\Lib\Blocks\Register_Block;
$block = new Register_Block([]);
$block->name = 'acme/book-card';
$block->attributes = (new Lipe\Lib\Blocks\Attributes([]))->get_args();
$block->supports()->align(['wide', 'full']);
register_block_type($block->name, $block->get_args());
Register_Block_Style
Fluent wrapper around register_block_style().
This class is property-driven through the shared args system and is useful for setting values such as style name, label, and inline_style before calling get_args().
Prop
Represents a single block attribute definition.
Key public methods
public function type(string $type): staticpublic function enum(array $values): staticpublic function default(mixed $value): staticpublic function role(string $role): staticpublic function source(): Source
Source
Configures how an attribute is sourced from markup or meta.
Key public methods
public function __construct(protected Prop $prop)public function attribute(string $selector, string $attribute): Proppublic function text(string $selector): Proppublic function html(string $selector): Proppublic function query(string $selector, array $query): Proppublic function meta(string $key): Prop
Supports
Builds the supports configuration for a block.
This builder is property-driven via Args; use it to set support flags before calling get_args().