Skip to content
Corex

BlockScaffolder

Corex\Cli\Generators\BlockScaffolder · class · CLI layer

Scaffolds a complete, registered, working DYNAMIC block from one name — the same shape the build pipeline expects: a block folder (block.json + index.js + style.scss) under <base>/Blocks/<slug>/, plus the PHP BlockRenderer class beside it at <base>/Blocks/<Name>Renderer.php. WP-CLI-independent and headless-testable: it only renders stubs and writes files (no WordPress, no register_block_type). The generated block is discovered by the corex-blocks engine (BlockMap → the build dir, or the source blocks/ dir headlessly) and previewed in the editor via <ServerSideRender>. Run npm run build to compile its index.js/style.scss.

__construct(StubRenderer $renderer, Naming $naming, string $stubsDir)

Section titled “__construct(StubRenderer $renderer, Naming $naming, string $stubsDir)”

scaffold(string $rawName, GeneratorContext $context, bool $force): BlockScaffoldResult

Section titled “scaffold(string $rawName, GeneratorContext $context, bool $force): BlockScaffoldResult”